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
525
Setting DataRecordCellArea in code
posted

 

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

Parents
No Data
Reply
  • 69686
    Verified Answer
    posted

    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

Children