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
490
Cannot find governing FrameworkElement or FrameworkContentElement for target element
posted

Hello,

I have a xamDataGrid whose DataContext is set to my view model.  There is a property on my view model, call it GridData, that the grid's DataSource is bound to.

GridData is a collection of MyObjects and each MyObject has a Color property.  I want to use the value of the MyObject's Color property as the color of the row.

I tried addind the following:

            <igDP:XamDataGrid.Resources>
                <Style TargetType="{x:Type igDP:DataRecordPresenter}">
                    <Setter Property="Background">
                        <Setter.Value>
                            <SolidColorBrush Color="{Binding Path=DataItem.Color}"/>
                            </Setter.Value>
                    </Setter>
                </Style>
            </igDP:XamDataGrid.Resources>

but I get the below error:

"Cannot find governing FrameworkElement or FrameworkContentElement for target element"

How can I bind the row Background to the DataItem's Color property?  Can I get a sample app demonstrating this please?

Thanks.

Parents
No Data
Reply Children