Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

DataGridCellTemplate with DataTemplate and DataTriggers in Code Behind?

$
0
0

Hi,

I have to create Datagrid columns on the fly using code.

is it possible to do the below template in Code Behind ?

<DataGridTemplateColumn><DataGridTemplateColumn.CellTemplate><DataTemplate><Border x:Name="brdBorder" Margin="1"><TextBlock Text ="{Binding Computer}" Margin ="1.1" x:Name="txtTextBlock"/></Border><DataTemplate.Triggers><DataTrigger Binding="{Binding Computer}" Value="UP"><Setter TargetName="brdBorder" Property="Background" Value="Green"/><Setter TargetName="txtTextBlock" Property="Foreground" Value="White"/></DataTrigger>                                    </DataTemplate.Triggers></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn>

Any help would really be appreciated.

thanks

exchposh


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>