Simple mod on a Int32PropertyEditor

Grids for WPF Forum

Posted 13 years ago by jeff jarrell
Version: 10.2.0533
Avatar
I have a simple mod to do on a Int32PropertyEditor. I need to read a descriptor to set the .Minimum and the .Maximum. I've tried a couple of things, inheriting int32PropertyEditor, putting it in a usercontrol. The big thing is I lose all of the stylings and bindings. I don't want to recreate all of this for this simple mod.

What is an easy suggested approach?

Thanks.

(I do have the styles. I'd be interested in seeing the bindings to the data accessor and how the appearance changes based upon readonly)

[Modified at 01/11/2011 10:52 AM]

Comments (2)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Jeff,

The Int32PropertyEditor doesn't use any styles, nor can you put it in a UserControl. It's meant to map a DataTemplate that uses Int32EditBox to one or more properties in the PropertyGrid. And is only valid in for use in PropertyGrid.PropertyEditors or BuiltinEditors.PropertyEditors collections.

If you meant that you create a class that derives from Int32EditBox, then you may lose all but the default Style. When switching themes, implicit Styles are used to "update" the look of the controls. Implicit Styles are not applied to any derived classes. So an implicit Style for Int32EditBox, will not be applied to a class that derives from Int32EditBox.

As this is a restriction enforced by WPF, the only way to work around it is to explicitly set the Style property. You can use code like the following in the constructor of your custom Int32EditBox:
this.SetResourceReference(StyleProperty, typeof(Int32EditBox));
If you've purchased WPF Studio, then you should have access to the default Styles through your account on our site. If you purchased PropertyGrid or Editors separately, please send our support an email and we can send the relevant files.


Actipro Software Support

Posted 13 years ago by jeff jarrell
Avatar
Ok. I've got it worked out. Thanks.
The latest build of this product (v24.1.2) was released 5 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.