We have an application where validation occurs on a separate thread from the UI thread. When new validation errors are identified, or old issues are fixed, we notify the appropriate object. Each object has a backing store that tracks the errors for each property. Thus, we can still query for an error string via the 'this indexer' that's defined in IDataErrorInfo. The problem is the property grid seems to do this immediately when the property changes, but the VM's backing store won't have been updated yet. Is there a way to handle async errors in the property grid?
1. Note that I've looked into modifying the templates. While I was able to get the TextBox template to work, I had issues getting the ComboBox template to show the changes to the borders via triggers. Additionally, I'd prefer to not make template changes if possible (or at least keep them simple) to keep maintenence simple as new releases come along, and since we use custom DataTemplates in a bunch of situations.
2. For our DataGrids, we handle this by modifying the cell style with triggers, which can cause an error border to appear around a cell when the property indexer fires:One challenge with adapting this approach to the property grid is that I don't see a way to create the {Binding Path=[Length]} on the fly for any property.
3. I've noticed that Silverlight has INotifyDataErrorInfo, which I suspect is exactly what we want. Does the WPF PropertyGrid support this?
4. Is there be a way to tell the property grid to recheck for an error on a property?
Thanks for any help you can give,
-Craig
[Modified at 12/13/2010 04:47 PM]
1. Note that I've looked into modifying the templates. While I was able to get the TextBox template to work, I had issues getting the ComboBox template to show the changes to the borders via triggers. Additionally, I'd prefer to not make template changes if possible (or at least keep them simple) to keep maintenence simple as new releases come along, and since we use custom DataTemplates in a bunch of situations.
2. For our DataGrids, we handle this by modifying the cell style with triggers, which can cause an error border to appear around a cell when the property indexer fires:
<DataTrigger
Binding="{Binding Path=[Length], UpdateSourceTrigger=PropertyChanged}"
Value="Error"
>
<Setter Property="BorderBrush" Value="{DynamicResource errorBrush}"/>
<Setter Property="BorderThickness" Value="{DynamicResource validationBorder}"/>
</DataTrigger>
3. I've noticed that Silverlight has INotifyDataErrorInfo, which I suspect is exactly what we want. Does the WPF PropertyGrid support this?
4. Is there be a way to tell the property grid to recheck for an error on a property?
Thanks for any help you can give,
-Craig
[Modified at 12/13/2010 04:47 PM]