I'm able to change the background of a row by binding a converter to the Background property of the DataRecordCellArea:
<Style TargetType="{x:Type igPresenter:DataRecordCellArea}"> <Setter Property="Background" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Content, Converter={StaticResource customHighlightConverter}}"/> </Style>
I would also like to know how to change this value if code. At the moment I'm using:
RecordPresenter presenter = DataRecordPresenter.FromRecord(Records[index]); if (presenter != null) { presenter.Background = brush; }
but this changes the background behind the Cell area that i've changed via binding.
How can i get access to the DataRecordCellArea in code to be able to update the background color?
Thanks,
Jamie
Thanks Alex, that's what I was looking for.
Hello Jamie,
Here is how to get the DataRecordCellArea in code :
DataRecordCellArea drc = Infragistics.Windows.Utilities.GetDescendantFromType(presenter,
typeof(DataRecordCellArea), false) as DataRecordCellArea;
drc.Background = new SolidColorBrush(Colors.Red);
Hope this helps
I've uploaded a sample application to show the problem that i'm having.
When i click on the record I want it to change from gray to red. It seems that I'm setting the background at the wrong level.