In my XamDataGrid.Resources I have:
<Style x:Key="InvalidStyle" TargetType="{x:Type igWPF:DataRecordCellArea}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=DataContext.DataItem.Invalid, RelativeSource={RelativeSource Self}}"
Value="True">
<Setter Property="Background" Value="Red"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
And then under my field layout I have:
<igWPF:FieldLayout.Settings>
<igWPF:FieldLayoutSettings DataRecordCellAreaStyle="{StaticResource InvalidStyle}">
</igWPF:FieldLayoutSettings>
</igWPF:FieldLayout.Settings>
The idea: The objects that my grid is bound to have a Boolean Invalid property. When this is True the background of that row should be Red.
I have verified that the backgrounds are set to red if I were to initialize Invalid to true. However when I set Invalid on the model the background is not updated.
How do I tell the view to update from the model?
I'm setting Invalid by getting the DataRecord and then DataItem of the CellValuePresenter for that Row and then changing Invalid on the DataItem.
The model that the Grid is bound to does have it's value updated but the grids values and style does not update.
Hello Caleb,
As mentioned in a very recent update to a support case we have together, I believe this and the value updates that you are referring to in support case CAS-188377-N5B9S3 are due to a possible lack of the INotifyPropertyChanged interface being implemented.
In the support case, I have attached a sample project demonstrating the results when the INotifyPropertyChanged interface is implemented, and your style and the "clear buttons" discussed in the support case work correctly. For consistency, I am also attaching said sample project to this thread.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer