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
610
Dynamic Removal of DataRecordCellArea Style
posted

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