Hi guys,
In my application I have a XamGrid that is bound to a ObservableCollection of objects. Each object has a boolean property called HasChanged which gets set to "True" anytime any of the properties in the object has changed. Im trying to show the users the rows that have been edited in a different color so they are aware and they can save the changes.
Currently this functionality is partially working. When I make changes to a property on an object, the row doesnt change color, but when I sort any of the columns the grid gets refreshed or repainted and the row changes to red. This is the code the I have for the DataTrigger:
<ig:XamGrid.Resources>
<Style TargetType="{x:Type ig:CellControl}">
<Style.Triggers>
<DataTrigger Binding="{Binding HasChanged, UpdateSourceTrigger=PropertyChanged}" Value="True">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ig:XamGrid.Resources>
Any help is appreciated.
Thank you
Hello,
Thank you for your post. I have been looking into it and I can suggest you implement INotifyPropertyChanged interface in your data class, if you didn’t do so far. Here you can read more about this:
http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=vs.110).aspx
If you already did this, could you please send an isolated sample project, where your issue is reproduced, so I can investigate it further for you.
Looking forward for your reply.
Hi Stefan,
Thank you for your reply. I am already implementing INotifyPropertyChanged interface in my data class. I think my issue my be on the settings I have to make on the XAML and the grid. Do you think you could provide me with a sample project? I am usisng the data trigger that I posted in my question above, but I am not sure if I need something else in the XamGrid.
Looking forward for your reply
I have created a sample project for you with the functionality you want. Basically instead of DataTriggers, I used the XamGrid built-in functionality for ConditionalFormatting. Please let me know if this helps you or you need further assistance on this matter.
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Stefan,
Thank you for the prompt reply. This worked out great!
Regards,