Datagrid Column Text Background Colour in WPF

Feb 22 2012 1:24 AM
Hi,
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">                       
                        <DataGridTextColumn.ElementStyle>                            
                            <Style TargetType="{x:Type TextBlock}">
                                <Setter Property="TextBlock.Background" Value="Gray" />
                                <Setter Property="TextBlock.FontSize" Value="12" />                                                               
                            </Style>                           
                        </DataGridTextColumn.ElementStyle>
</DataGridTextColumn>

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

can anyone help which trigger to be used here

Answers (2)