Hello!!
I have a xamDataGrid with a style targeting DataRecordCellArea. In that style it sets BackgroundSelected to a color.
<Style TargetType="{x:Type igDP:DataRecordCellArea}"> ... <Setter Property="BackgroundActive"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Offset="0" Color="#FFc2dfff"/> <GradientStop Offset="1" Color="#FF9ac9fd"/> </LinearGradientBrush> </Setter.Value> </Setter> ...</Style>
What I want to do is, when a user clicks a button in my application, I want to turn off that BackgroundSelected (or just change the brush to white). I *think* I need to do this in c# code behind because it relies on a user click. I have tried looping through the records and changing the DataRecordCellArea's .style property as well as it's Background.Color property. Both seem to turn the background white, but if a user clicks on any row, it goes right back to the gradient in the original style (the style pasted above).
Maybe I am not approaching this one correctly. What I really need is for the active record to hide the highlighted record when in one mode, and to show the highlight in another mode. The modes will be switched by a button click event in code behind.
Any suggestions?
Thanks,
Jeff
HI,
Set a binding to for the BackgroundSelected property. Bind it to a property in your ViewModel.
I am attaching a sample that does this.
Sincerely,
MattDeveloper Support Engineer
Your sample worked like a charm! Thanks for the help!
-Jeff
Please let me know if you need further assistance.
Sincerely, Matt Developer Support Engineer