Datagrid Column Text Background Colour in WPF

Feb 22 2012 1:24 AM
im having a grid and in that there are 3columns
for one column im highlighting the text background color and im success for that
with the following code

<DataGridTextColumn Header="" Binding="{Binding ServiceType.Name}" Width="75">                       
                            <Style TargetType="{x:Type TextBlock}">
                                <Setter Property="TextBlock.Background" Value="Gray" />
                                <Setter Property="TextBlock.FontSize" Value="12" />                                                               

now when in click any row in
DataGrid i would like to change the color from 'Gray' to 'White'
<Setter Property="TextBlock.Background" Value="Gray" /> to <Setter Property="TextBlock.Background" Value="White" />

can anyone help which trigger to be used here

Answers (2)