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.
Hello John,
Thank you for your post. I have been looking into it and the sample Diyan uploaded and I modified it, so now it uses a Converter to return a new SolidColorBrush object based on the DataItem’s Color Property and now the Error no longer exists. Please let me know if this helps you or you need further clarifications on this matter.
Looking forward for your reply.
I am having the same problem. I downloaded the sample code and the sample code exhibits the same problem that the first user (and I) are seeing. It is here:
Hi,
I tried your code and it was working fine. I am attaching a sample application.
Let me know if this doesn’t work for you.
Thanks,
Diyan Dimitrov
Any idea?