Register PropertyEditor for declared type

Grids for WPF Forum

Posted 14 years ago by Michael Rösslhumer
Version: 9.2.0515
Avatar
Is it possible to register a property editor only for a property on a declared type. Not with an attribute, i would like to do this in such a way PropertyGrid.PropertyEditors.Add(new PropertyEditor(propertyName, may propertyType, DECLARED TYPED). I did not really found such a feature in your help. For me it only seems to be possible to register an editor for a property with a defined name and type. May i only did not find what i searched, i hope you can give a hint!
kind regards

Comments (6)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Michael,

That is not currently support, but I've marked down a TODO item for that feature.

The PropertyGrid.ValueTemplateSelector, which is a DataTemplateSelector, is used to select the associated DataTemplate. Until we get around to adding this feature, you could use a custom DataTemplateSelector and a custom PropertyEditor (that has a property for the object's type) to build this functionality.

We initialize that property to a custom DataTemplateSelector (called ValueTemplateSelector) the performs the default look up (i.e. checking EditorAttribute, PropertyGrid.PropertyEditors, BuiltinEditors.PropertyEditors). Unfortunately, that type is internal so you can't extend it.

I've made these classes public for the next maintenance release, but your custom DataTemplateSelector could wrap the DataTemplateSelector in PropertyGrid.ValueTemplateSelector. Then you could perform your own look up, otherwise delegate it to our default DataTemplateSelector.


Actipro Software Support

Posted 14 years ago by Craig - Varigence, Inc.
Avatar
I just want to second Michael's request. I was able to workaround the lack of DeclaredType support as you suggested, but I'd much prefer having the PropertyEditor XAML handle this directly.

Thanks,

-Craig
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Craig,

Thanks for your feedback, and we'll make a note of your request.


Actipro Software Support

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Just fyi, we've implemented this feature for the next maintenance release. This allows you to map a property editor to a property on a specific object type. You can even specify a base class type and/or an interface type.


Actipro Software Support

Posted 13 years ago by Rougnon-Glasson
Avatar
Hi,
nice to read that. What is the way to do that?
Thanks in advance,
Jrg
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

The feature has not been release yet, but you will be able to specify the ObjectType, in addition to the PropertyType and/or PropertyName on instances of PropertyEditor. Previously, the object's type was not used in determining what editors to apply to properties. If ObjectType is left as it's default of null, then it will not be used.


Actipro Software Support

The latest build of this product (v24.1.1) 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.