Gets or sets the cell template.
Namespace: Dapfor.Wpf.ControlsAssembly: Dapfor.Wpf (in Dapfor.Wpf.dll) Version: 4.1.0.26317 (4.1.0.26317)
Syntax
C# |
---|
public DataTemplate CellTemplate { get; set; } |
Visual Basic |
---|
Public Property CellTemplate As DataTemplate Get Set |
Visual C++ |
---|
public: property DataTemplate^ CellTemplate { DataTemplate^ get (); void set (DataTemplate^ value); } |
F# |
---|
member CellTemplate : DataTemplate with get, set |
Property Value
Type: DataTemplateThe cell template.
Remarks
Cell templatization enables usage of any controls in grid cells via data templates. Templates are usually defined as resources in XAML files. To use a template, it should be set in the required grid column.
Cell data templates enable simple binding to cell content. For this purpose an object of Cell type is transferred as Content. This object has many useful properties including Cell.Text can be used for displaying text.
An object of Cell type has Cell.Value property that can be used to get unformatted values of data objects. These values can be used in cell data templates via converters.
Copy | |
---|---|
<!-- Resources --> <Window.Resources> <TestApplication:MyCollection x:Key="someCollection" /> <TestApplication:IntToFlagValueConverter x:Key="intToFlagConverter"/> <DataTemplate x:Key="cellTemplate"> <Grid> <Image Source="{Binding Path=Value, Converter={StaticResource intToFlagConverter}}"/> <Grid Grid.Column="1"> <Ellipse Fill="Green"/> <TextBlock Text="{Binding Path=Text}" HorizontalAlignment="Center" Foreground="Red"/> </Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition/> </Grid.ColumnDefinitions> </Grid> </DataTemplate> </Window.Resources> <!-- GridControl declaration --> <df:GridControl Name="grid"> <df:GridControl.Headers> <df:Header> <df:Header.Columns> <df:Column Id="Value1" Title="Column 0" CellTemplate="{StaticResource cellTemplate}" Width="100" /> <df:Column Id="Value2" Title="Column 1" Width="100" /> </df:Header.Columns> </df:Header> </df:GridControl.Headers> </df:GridControl> |