| C1.Xaml.FlexGrid アセンブリ > C1.Xaml.FlexGrid 名前空間 > Column クラス : CellTemplate プロパティ |
'宣言 Public Property CellTemplate As Windows.UI.Xaml.DataTemplate
public Windows.UI.Xaml.DataTemplate CellTemplate {get; set;}
CellTemplate プロパティと CellEditingTemplate プロパティは、Microsoft DataGrid for Silverlight/WPF の相当するプロパティと同様に機能します。
これらのプロパティは XAML で定義でき、列内のセルを表すビジュアル要素の作成に使用されます。
CellTemplate は通常のモードでセルを作成し、CellEditingTemplate は編集モードでセルを作成します。
ほとんどの場合、カスタムテンプレートが含まれてる列にも Binding を指定する必要があることに注意してください。グリッド内の値を表示および編集するためにはテンプレートが使用されますが、クリップボードやエクスポートのサポートなどの目的でデータ値を取得する場合には、列の連結が使用されます。
<c1:C1FlexGrid x:Name="_fgTemplated"> <c1:C1FlexGrid.Columns> <!-- add a templated column --> <!-- Binding used only for clipboard and export support --> <c1:Column Binding="{Binding Name}" Header="Template" Width="200"> <!-- template for cells in display mode --> <c1:Column.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Name}" Foreground="Green" FontWeight="Bold" /> </DataTemplate> </c1:Column.CellTemplate> <!-- template for cells in edit mode --> <c1:Column.CellEditingTemplate> <DataTemplate> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Image Source="edit_icon.png" Grid.Column="0" /> <TextBox Text="{Binding Name, Mode=TwoWay}" Grid.Column="1" /> </Grid> </DataTemplate> </c1:Column.CellEditingTemplate> </c1:Column> </c1:C1FlexGrid.Columns> </c1:C1FlexGrid>
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2