SPREAD for WPF 3.0J - GcSpreadGrid
ContentPath プロパティ (ComboBoxCellType)
使用例 

GrapeCity.Windows.SpreadGrid 名前空間 > ComboBoxCellType クラス : ContentPath プロパティ
ComboBoxCellType に表示されるプロパティの名前を示す値を取得または設定します。これは依存関係プロパティです。
シンタックス
'宣言
 
Public Property ContentPath As String
public string ContentPath {get; set;}
解説
ContentPath では、ドット付きのパスを使用してプロパティのサブプロパティを参照できます。ContentPath プロパティは、項目を表示するためにドロップダウンコントロールに設定されます。
使用例
次のサンプルは ComboBoxCellType に ContentPath および SelectedValuePath を使用してデータソースを設定する方法を説明します。
public void SingleColumnBinding()
{
ComboBoxCellType combo = new ComboBoxCellType();
combo.ItemsSource = new string[] {"Alice","Robert","Ken","Alen" };
gcSpreadGrid1[0, 0].CellType = combo;
}
public void MultipleColumnsBinding()
{
ComboBoxCellType combo = new ComboBoxCellType();
combo.UseMultipleColumn = true;
combo.DropDownWidth = 150;
combo.ContentPath = "FirstName";
combo.SelectedValuePath = "LastName";
combo.ItemsSource = new NameList();
gcSpreadGrid1[0, 0].CellType = combo;
}

public class NameList : ObservableCollection<PersonName>
{
public NameList()
: base()
{
Add(new PersonName("Alice", "Cather"));
Add(new PersonName("Robert", "Dinesen"));
Add(new PersonName("Ken", "Hugo"));
Add(new PersonName("Alen", "Verne"));
}
}

public class PersonName
{
private string firstName;
private string lastName;

public PersonName(string first, string last)
{
this.firstName = first;
this.lastName = last;
}

public string FirstName
{
get { return firstName; }
set { firstName = value; }
}

public string LastName
{
get { return lastName; }
set { lastName = value; }
}
}
Public Sub SingleColumnBinding()
Dim combo As New ComboBoxCellType()
combo.ItemsSource = New String() {"Alice", "Robert", "Ken", "Alen"}
gcSpreadGrid1(0, 0).CellType = combo
End Sub
Public Sub MultipleColumnsBinding()
Dim combo As New ComboBoxCellType()
combo.UseMultipleColumn = True
combo.DropDownWidth = 150
combo.ContentPath = "FirstName"
combo.ItemsSource = New NameList()
gcSpreadGrid1(0, 0).CellType = combo
End Sub

Public Class NameList
Inherits ObservableCollection(Of PersonName)
Public Sub New()
MyBase.New()
Add(New PersonName("Alice", "Cather"))
Add(New PersonName("Robert", "Dinesen"))
Add(New PersonName("Ken", "Hugo"))
Add(New PersonName("Alen", "Verne"))
End Sub
End Class

Public Class PersonName
Private m_firstName As String
Private m_lastName As String

Public Sub New(first As String, last As String)
Me.m_firstName = first
Me.m_lastName = last
End Sub

Public Property FirstName() As String
Get
Return m_firstName
End Get
Set(value As String)
m_firstName = value
End Set
End Property

Public Property LastName() As String
Get
Return m_lastName
End Get
Set(value As String)
m_lastName = value
End Set
End Property
End Class
参照

ComboBoxCellType クラス
ComboBoxCellType メンバ