I have created a datagrid in WPF…
I have defined several custom Columns..
<my:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding HeadC}" />
<TextBlock Text="{Binding HeadCPercent}" Foreground="#FFF05D1D" />
</StackPanel>
</DataTemplate>
</my:DataGridTemplateColumn.CellTemplate>
The problem is that when a row is slected the seconds textblock color doesnt change and it is hardly visible…
Any solution to this problem ?
Add
DataTriggerto theDataTemplatetriggers collection that would change foreground based on selected state of the row. Like in the following example:I took this answer as a basis and adjusted it to your question. I could made a typo in the code but you should get the idea :). Hope it helps.