BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
public class GridCellTemplateSelectorEXt : DataTemplateSelector
{
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
if (item == null)
return null;
if (((item as OrderInfo).OrderID % 2) == 0)
return App.Current.MainWindow.Resources["template1"] as DataTemplate;
else
return App.Current.MainWindow.Resources["template2"] as DataTemplate;
}
} |
<Window.Resources>
<DataTemplate x:Key="template1">
<StackPanel Orientation="Horizontal">
<Button Content="B1" Margin="5"/>
<Button Content="B2" Margin="5"/>
<Button Content="B3" Margin="5"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="template2">
<StackPanel Orientation="Horizontal">
<Button Content="B1" Margin="5"/>
<Button Content="B2" Margin="5"/>
</StackPanel>
</DataTemplate>
<local:GridCellTemplateSelectorEXt x:Key="template"/>
</Window.Resources>
<syncfusion:GridTemplateColumn MappingName="CustomerID"
syncfusion:FocusManagerHelper.WantsKeyInput="True"
CellTemplateSelector="{StaticResource template}"
syncfusion:VisualContainer.WantsMouseInput="True"/> |