GrapeCity SPREAD for WPF 2.0J
ItemsSource プロパティ (RadioGroupCellType)

ラジオグループセルの内容の生成に使用されるコレクションを取得または設定します。
構文
'Declaration
 
Public Property ItemsSource As IEnumerable
public IEnumerable ItemsSource {get; set;}

プロパティ値

ラジオグループセルの内容の生成に使用されるコレクション。既定値は null 参照 (Visual Basicでは Nothing) です。
次のサンプルはRadioGroupCellTypeにデータソースを設定する方法を説明します。
public void SetArraySource()
{
    RadioGroupCellType radio = new RadioGroupCellType();
    radio.ItemsSource = new string[] { "Alice", "Robert", "Ken", "Alen" };
    gcSpreadGrid1[0, 0].CellType = radio;
}

public void SetItemsSource()
{
    RadioGroupCellType radio = new RadioGroupCellType();
    radio.ItemsSource = new NameList();
    radio.DisplayMemberPath = "FirstName";
    radio.SelectedValuePath = "LastName";
    gcSpreadGrid1[0, 0].CellType = radio;
}

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 SetArraySource()
    Dim radio As New RadioGroupCellType()
    radio.ItemsSource = New String() {"Alice", "Robert", "Ken", "Alen"}
    gcSpreadGrid1(0, 0).CellType = radio
End Sub

Public Sub SetItemsSource()
    Dim radio As New RadioGroupCellType()
    radio.ItemsSource = New NameList()
    radio.DisplayMemberPath = "FirstName"
    radio.SelectedValuePath = "LastName"
    gcSpreadGrid1(0, 0).CellType = radio
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
参照

RadioGroupCellType クラス
RadioGroupCellType メンバ

 

 


Copyright © 2012 GrapeCity inc. All rights reserved.