Hi All,
I am Trying to change Datagrid cell background color at runtime by using datatrigger, datatrigger works fine but that is very slow.
Code:
<DataGridTextColumn.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="{Binding Background, ElementName=txtFont, UpdateSourceTrigger=PropertyChanged}"/>
<Setter Property="Background" Value="{Binding Background, ElementName=txtBackground, UpdateSourceTrigger=PropertyChanged}" />
</Trigger>
<DataTrigger Binding="{Binding ColorBIDQty, UpdateSourceTrigger=PropertyChanged}" Value="1">
<Setter Property="Background" Value="{Binding Background, ElementName=txtDownTick, UpdateSourceTrigger=PropertyChanged}" />
</DataTrigger>
<DataTrigger Binding="{Binding ColorBIDQty, UpdateSourceTrigger=PropertyChanged}" Value="2">
<Setter Property="Background" Value="{Binding Background, ElementName=txtBackground, UpdateSourceTrigger=PropertyChanged}" />
</DataTrigger>
<DataTrigger Binding="{Binding ColorBIDQty, UpdateSourceTrigger=PropertyChanged}" Value="3">
<Setter Property="Background" Value="{Binding Background, ElementName=txtUpTick, UpdateSourceTrigger=PropertyChanged}" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.CellStyle>
In the above code i am trying to change the cell background color on the basis of ColorBidQty. The color is not changing in the speed as i expect.
I have erased some text from image because of confidential matter.
Please try to help me
Thanks,
Kailash