I am using the 9.2.20092.2001 hot fix of the 9.2 libraries and am having a hard time getting IDataErrorInfo support to work correctly. I have a class called Data that implements INotifyPropertyChanged and IDataErrorInfo. My IDataErrorInfo properties both have a Console.WriteLine in there to let me know when they are being called.When the data is first bound to the grid, the Error property is called multiple times. However, the this[string columnName] property is never called. Whenever I update a property, nothing happens. Should I be notifying when my Error property changes? Is there a sample somewhere on how to properly implement IDataErrorInfo so that the XamDataGrid supports it.
Edit: I am setting the properties: DataGrid.FieldLayoutSettings.DataErrorDisplayMode = DataErrorDisplayMode.Default; DataGrid.FieldLayoutSettings.SupportDataErrorInfo = SupportDataErrorInfo.RecordsAndCells;
Thanks,-Szymon
Hi Szymon,
There's an IDataErrorInfo sample in the XamFeatureBrowser under xamDataGrid -> Layout and Behavior that implements IDataErrorInfo on a list object. Having said that, I don't know why the IDataErrorInfo indexer is not getting called initially - I'd think that it should for cells that are displayed in the data presenter when the window comes up. Cell errors are displayed in the feature browser sample mentioned above so I'm not sure what's different about your setup. Can you post a sample or code snippet?
Also you should notify when the Error property changes and also when the error for a field changes (for the field error, raise the property change event for the property of the object associated with that field).
Hope this helps,
Sandip
I managed to replicate in XAML:
<igDP:XamDataGrid x:Name="grid" DataSource="{Binding}"> <igDP:XamDataGrid.FieldLayoutSettings> <igDP:FieldLayoutSettings SupportDataErrorInfo="RecordsAndCells" AutoGenerateFields="False" DataErrorDisplayMode="ErrorIconAndHighlight" />
</igDP:XamDataGrid.FieldLayoutSettings> <igDP:XamDataGrid.FieldLayouts> <igDP:FieldLayout> <igDP:FieldLayout.Fields> <igDP:UnboundField Label="First Name" BindingPath="FirstName" BindingMode="TwoWay"> <igDP:UnboundField.Settings> <igDP:FieldSettings AllowEdit="False" /> </igDP:UnboundField.Settings> </igDP:UnboundField>
<igDP:UnboundField Label="Last Name" BindingPath="LastName" BindingMode="TwoWay"> <igDP:UnboundField.Settings> <igDP:FieldSettings AllowEdit="False" /> </igDP:UnboundField.Settings> </igDP:UnboundField>
<igDP:UnboundField Label="Age" BindingPath="Age" BindingMode="TwoWay"> <igDP:UnboundField.Settings> <igDP:FieldSettings AllowEdit="True" /> </igDP:UnboundField.Settings> </igDP:UnboundField> </igDP:FieldLayout.Fields> </igDP:FieldLayout> </igDP:XamDataGrid.FieldLayouts>
In this case, it doesn't work. But if I do not declare my fields and set AutoGenerateFields to True, it works.