Hi
I want to change the background color for the rows of a xamgrid based on the condition. When i try the below code it is not successfully applying to all the columns or cells.
<Style TargetType="ig:CellControl">
<Setter Property="Background" Value="{Binding RowData.MaturityTenorViewModel.Tenor, Converter={StaticResource ColorConverter}}"></Setter>
</Style>
But when i use the below code it is able to set to all the colums in a row
<Setter Property="Background" Value="Red"></Setter>
I have both TextColumn and Unbound columns in the grid. But the catch here is if i change the TextColumn to Unbound the conditional binding is working for all the columns.
Why there is no background color property for the row ? and how to make this work ?
Hello,
Thank you for your post. I have been looking into it and I can say that the DataContext for the CellControl is the underlying object and this is why your Binding doesn’t work. I can suggest you change it like this so you can get the “Tenor” value in your ColorConverter:
<Style TargetType="ig:CellControl"> <Setter Property="Background" Value="{Binding Tenor, Converter={StaticResource ColorConverter}}"/> </Style>
Please let me know if you have further questions on this matter.
Looking forward for your reply.
Sorry for very late reply. The alternative what you suggsted is not working.
But when i try to change the binding found some changes.
When the Binding is ---- {Binding RowData.MaturityTenorViewModel.Tenor, Converter={StaticResource ColorConverter}}" The color is applied to Unbound columns.
When the Binding is ---- {Binding MaturityTenorViewModel.Tenor, Converter={StaticResource ColorConverter}}" The color is applied to Text columns.
When the Binding is ---- {Binding Tenor, Converter={StaticResource ColorConverter}}" The color is applied to None(No effect).
Hello Kartik,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.