Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
160
Change row and font color based on cell value
posted

Hello,

I have a requirement to change the row and font colors based on the values of a cell in my grid.  One of the necessary colors is white font a dark green background.  I have the following code in my view -

 <Controls:XamDataGrid.Resources>
 <Style x:Key="style" TargetType="{x:Type igDP:DataRecordCellArea}" >
  <Setter Property="Background" 
    Value="{Binding Record.DataItem.ColorIndex, RelativeSource={RelativeSource Self}, Converter={StaticResource IntegerToRowColorConverter}}" />
  <Setter Property="Foreground"
    Value="{Binding Record.DataItem.ColorIndex, RelativeSource={RelativeSource Self}, Converter={StaticResource IntegerToFontColorConverter}}" />  
 </Style>               
</Controls:XamDataGrid.Resources>

.

.

.

<igDP:FieldLayout>                        
 <igDP:FieldLayout.Settings >                       
  <igDP:FieldLayoutSettings DataRecordCellAreaStyle="{StaticResource style}" />                                                                                                        
 </igDP:FieldLayout.Settings>
 <igDP:UnboundField Name="colorindex" BindingPath="ColorIndex" Label="colorindex"  >

.

.

This is working fine when my view launches - everything is formatted as it should be.

However, I am running into issues when I click on a cell in the grid.  When clicked, the font is turning back to black.  When I then click on another cell, the black font stays and doesn't not turn back to white.

Is there something that is firing on the XamDataGrid that might be causing this?  Does anyone see any issues with the code I am currently using?

Thanks for any thoughts.

 

Parents Reply Children