PropertyGrid Dependent Properties Validation

Grids for WPF Forum

Posted 7 years ago by Vinay Chougule
Version: 11.2.0551
Avatar

Hello,

I'm using PropertyGrid (ActiproSoftware.PropertyGrid.Wpf.dll, Ver 11.2.551.0).

The items are populated by setting SelectedObjects.

On a custom control I have the properties Min and Max. The properties are dependent on each other. (Min, Max is just an example. We have many such properties dependent on each other.) Setting one property can put the other in error condition. e.g. If Min=0, and Max=10 is OK condition. Now if user sets Min=20, then Max is in error condition.

I'm using DataErrorValidationRule by implementing the IDataErrorInfo interface on my objects. This works fine for the edited properties. I can get the Red border to appear on the edited property.

Question: If user edits Min property, then how can I show a red border around Max property?

Thanks in advance for your help.

-Vinay

Comments (4)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Vinay,

Offhand, assuming your object supports INotifyPropertyChanged, what happens if you raise the PropertyChanged event for Max when the Min property is altered?


Actipro Software Support

Posted 7 years ago by Vinay Chougule
Avatar

Hello Support Team,

I tried your suggestion.

Nothing happens.

We are using a class "SourcedPropertyDescriptorDataAccessor" dervied from ActiproSoftware.Windows.Controls.PropertyGrid.Primitives.PropertyDescriptorDataAccessor. The properties are bound to this class. On setting value to Min property, in derived override SourcedPropertyDescriptorDataAccessor.set_ValueInternal is called. Here I'm calling

OnPropertyChanged(this, new PropertyChangedEventArgs("Max"));

The IDataErrorInfo.get_Error is not called for Max.

Please help.

Kind Regards,

Vinay

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Vinay,

It's hard to say without debugging it.  Can you please put together a new simple sample project that shows the issue?  Make sure the project is as minimal as possible so that it is easy to debug what's happening.  Rename the .zip file extension and email you our support address.  Reference this post in your email too.  Thanks!


Actipro Software Support

Posted 6 years ago by Vinay Chougule
Avatar

Dear Support Team,

I have emailed you the sample.

Kind Regards,

Vinay

The latest build of this product (v2019.1 build 0681) was released 10 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.