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

選択された項目からセルの値を取得するために使用されるプロパティパスを取得または設定します。
構文
'Declaration
 
Public Property SelectedValuePath As String
public string SelectedValuePath {get; set;}

プロパティ値

選択された項目からセルの値を取得するために使用されるプロパティパス。
次のサンプルはDisplayMemberPathプロパティとSelectedValuePathプロパティを使ってデータソースを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.