If I understand you correctly, you propose that I would add an event handler to the IntegerUpDown. This was I have a hook to when the user would write in text for an integer property (likewise for double properties).
From this suggestion I see a couple of problems.
1. InputValidationErrorEventArgs API does not seem to provide me with a way to prevent the rollback from happening. To achieve consistent behavior with the default WPF behavior, I want to keep the text in the internal TextBox (I’m assuming that your implementation of IntegerUpDown is using this element) all the while the bound numerical property is unchanged. The PropertyItem would then be marked as invalid, showing a red border and having a tooltip that explains for example being unable to cast to a double.
2. I can’t seem to find an easy way to attach to an event handler that the InputValidationError event you specified. Given that I’m using PropertyGrid.AutoGenerateProperties (as it should handle different object types set on PropertyGrid.SelectedObject), I’ve noticed that PropertyGrid.PropertyDefinitions is empty, EditorDefinitions is also empty and that the particular PropertyItem from ProperyGrid.Properties has Editor property null. How would one be able to reach the IntegerUpDown instance to perform the suggested event subscription?
3. Assuming that IntegerUpDowns implementation doesn’t support my requirement, I can offcourse define my own ITypeEditor implementation that does. If there a way that I can configure PropertyGrid to use this editor as default editor instead of the default IntegerUpDown? Or do I really have to decorate all my numerical properties with EditorAttribute?