[]
ラジオグループ型セルは、設定した項目の数のラジオボタンをセルに表示します。RadioGroupCellType クラスを使用して設定します。主な設定は次のとおりです。
!type=note
メモ:デザイナを使用した設定方法については、「ラジオグループ型セルの設定」をご覧ください。
ラジオグループ型セルに表示する項目のデータソースを ItemsSource プロパティに設定します。

ラジオボタンに表示するテキストとして使用するデータソースのフィールド名を DisplayMemberPath プロパティに、ラジオボタンが選択されたとき、セルの値として使用するフィールド名を SelectedValuePath プロパティに設定します。
サンプルコード
RadioGroupCellType rdo = new RadioGroupCellType();
rdo.ItemsSource = new MyRadioGroupDataList();
rdo.SelectedValuePath = "ID";
rdo.DisplayMemberPath = "Caption";
gcSpreadGrid1.Columns[0].CellType = rdo;public class MyRadioGroupData
{
public int ID { set; get; }
public string Caption { set; get; }
}
public class MyRadioGroupDataList : List<MyRadioGroupData>
{
public MyRadioGroupDataList()
{
Add(new MyRadioGroupData() { ID = 1, Caption = "保留" });
Add(new MyRadioGroupData() { ID = 2, Caption = "承認" });
Add(new MyRadioGroupData() { ID = 3, Caption = "却下" });
}
}Dim rdo As New RadioGroupCellType()
rdo.ItemsSource = New MyRadioGroupDataList()
rdo.SelectedValuePath = "ID"
rdo.DisplayMemberPath = "Caption"
GcSpreadGrid1.Columns(0).CellType = rdoPublic Class MyRadioGroupData
Public Property ID() As Integer
Get
Return m_ID
End Get
Set(value As Integer)
m_ID = Value
End Set
End Property
Private m_ID As Integer
Public Property Caption() As String
Get
Return m_Caption
End Get
Set(value As String)
m_Caption = Value
End Set
End Property
Private m_Caption As String
End Class
Public Class MyRadioGroupDataList
Inherits List(Of MyRadioGroupData)
Public Sub New()
Add(New MyRadioGroupData() With {.ID = 1, .Caption = "保留"})
Add(New MyRadioGroupData() With {.ID = 2, .Caption = "承認"})
Add(New MyRadioGroupData() With {.ID = 3, .Caption = "却下"})
End Sub
End Class次の図のようにラジオボタンにテキスト以外の内容を表示する場合を表示する場合、ItemContentTemplate プロパティにデータ テンプレートを設定します。

サンプルコード
<Window x:Class="SpreadGridSampleCodes.sgrdocell"
:
xmlns:localdb="clr-namespace:SpreadGridSampleCodes.Data">
<Window.Resources>
<localdb:MyRadioGroupPathDataList x:Key="MyRadioGroupPathDataList"/>
<DataTemplate x:Key="MyRadioGroupItemTemplate">
<Path Stretch="Uniform" Fill="#FF000000" Data="{Binding PathData}"/>
</DataTemplate>
</Window.Resources>
<Grid>
<sg:GcSpreadGrid>
<sg:GcSpreadGrid.Columns>
<sg:Column>
<sg:Column.CellType>
<sg:RadioGroupCellType ItemsSource="{StaticResource MyRadioGroupPathDataList}"
ItemContentTemplate="{StaticResource MyRadioGroupItemTemplate}"
Orientation="Horizontal"/>
</sg:Column.CellType>
</sg:Column>
</sg:GcSpreadGrid.Columns>
</sg:GcSpreadGrid>
</Grid>
</Window>namespace SpreadGridSampleCodes.Data
{
public class MyRadioGroupPathData
{
public int ID { set; get; }
public string PathData { set; get; }
public string Desc { set; get; }
}
public class MyRadioGroupPathDataList : List<MyRadioGroupPathData>
{
public MyRadioGroupPathDataList()
{
Add(new MyRadioGroupPathData() { ID = 1, PathData = "M 0 0 L 4 8 L 8 0 Z", Desc = "DownArrow" });
Add(new MyRadioGroupPathData() { ID = 2, PathData = "M 0 8 L 8 8 L 4 0 Z", Desc = "UpArrow" });
}
}
}Namespace Data
Public Class MyRadioGroupPathData
Public Property ID() As Integer
Get
Return m_ID
End Get
Set(value As Integer)
m_ID = value
End Set
End Property
Private m_ID As Integer
Public Property PathData() As String
Get
Return m_PathData
End Get
Set(value As String)
m_PathData = value
End Set
End Property
Private m_PathData As String
Public Property Desc() As String
Get
Return m_Desc
End Get
Set(value As String)
m_Desc = value
End Set
End Property
Private m_Desc As String
End Class
Public Class MyRadioGroupPathDataList
Inherits List(Of MyRadioGroupPathData)
Public Sub New()
Add(New MyRadioGroupPathData() With {.ID = 1, .PathData = "M 0 0 L 4 8 L 8 0 Z", .Desc = "DownArrow"})
Add(New MyRadioGroupPathData() With {.ID = 2, .PathData = "M 0 8 L 8 8 L 4 0 Z", .Desc = "UpArrow"})
End Sub
End Class
End NamespaceOrientation プロパティで設定します。