PropertyDescriptorPropertyModel doesn't implement IConvertible

Editors for WPF Forum

Posted 1 year ago by Antoine Picard
Version: 18.1.0672
Avatar

Hi,

I created a simple custom editor for IList properties with a button. It's the same as the basic IList behavior but as I want to handle what's happening when I click on the button, I decided to create my own editor.

When I click on the button, I'm trying to retrieve the corresponding property in the event in the code behind but everything is wrapped in PropertyDescriptorPropertyModel... I managed to get this using the RoutedEventArgs e as ((Button)e.OriginalSource).DataContext; but I struggle to retrieve the exact object with the right type... I found the type in ValueType property but as PropertyDescriptorPropertyModel doesn't implement IConvertible, I can cast my property to its right type...

I don't know if I'm clear enough but am I missing something ?

Antoine P

Comments (2)

Answer - Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Antoine,

The PropertyDescriptorPropertyModel basically wraps a PropertyDescriptor.  Its ValueType property returns "propertyDescriptor.PropertyType".  And its Value property gets/sets the reflected property's value on the property descriptor.  Thus you can get/set the PropertyDescriptorPropertyModel.Value to retrieve or change the property.  Is that what you need?


Actipro Software Support

Posted 1 year ago by Antoine Picard
Avatar

Hi !

that's exactly what I was looking for !

Thanks a lot !

Antoine P

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

Add Comment

Please log in to a validated account to post comments.