The Actipro Blog

All the latest UI control development news from Actipro

Editors / PropertyGrid interop features coming in WPF Studio v5.0

We are working hard to get WPF Studio 5.0 released, which includes our new Editors for WPF product. By themselves, the controls provided by Editors for WPF are extremely useful, but we also wanted to make them easy to integrate into our PropertyGrid for WPF product. In order to keep both products segregated, we created an interop assembly that ties the two products together. This allows each product to be sold separately, while still providing reusable code and samples for customers who own both products.

PropertyGridBrushEditBoxOpen

A PropertyGrid with various Editors controls included

Interop Functionality

The PropertyGrid uses "property editors" to tie a properties to controls, by property name and/or property type. For example, you can tell the PropertyGrid that all properties of the type DateTime should use MyControlA and all properties of the type String should use MyControlB. This gives you a lot of control over what control is used for the various properties. In reality, the "control" is actually a DataTemplate since it will most likely be used multiple times.

The Editors/PropertyGrid Interop assembly provides several configurable property editors that utilize controls from Editors for WPF and can be quickly "dropped-in" to a PropertyGrid. There is a property editor for each of the following controls:

  • BrushEditBox
  • ColorEditBox
  • DateTimeEditBox
  • DoubleEditBox
  • GuidEditBox
  • Int32EditBox
  • Int32RectEditBox
  • MaskedTextBox
  • PointEditBox
  • RectEditBox
  • SizeEditBox
  • VectorEditBox

Each control has at least one associated property editor in the Editors/PropertyGrid Interop product. With the exception of the MaskedTextBox property editor, the property editors will automatically specify the associated type (e.g. BrushEditBox will associated with the Brush type), but you can always customize this behavior. Additionally, any value type controls (e.g. ColorEditBox, DateTimeEditBox, etc) also have a property editor for their associated nullable-type. For example, there is a ColorValuePropertyEditor for the Color type as well as a NullableColorValuePropertyEditor for the Color? type, both of which leverage the ColorEditBox.

Each property editors exposes some of the more common settings available on their associated control. For example, the MaskedTextBoxPropertyEditor has a Mask property that allows you to set the associated Mask on the underlying MaskedTextBox. Remember that the controls are defined using a DataTemplate, so normally you don't have easy access to their settings. Using the settings available on the property editor, you can quickly configure the underlying controls and/or dynamically update their settings. Additionally, you can reuse a single property editor for different properties. For example, you can define two instances MaskedTextBoxPropertyEditor each with a unique mask and each mapped to different property types. This is something you couldn't easy do before with static DataTemplates.

We've included a demo in our Sample Browser that shows how to use the Editors/PropertyGrid Interop product.

Custom Property Editors

As before, you can also build your own property editors using the controls in the new Editors for WPF framework. You can also extend and customize the property editors provided by the Editors/PropertyGrid Interop product, giving you total control over how things look and feel.

We've also included a demo in our Sample Browser that shows how to extend the Editors/PropertyGrid Interop product and build a custom property editor.

Summary

The Editors/PropertyGrid Interop product will make integrating the new the Editors for WPF product into our PropertyGrid much simpler.

Filed under: Actipro, In development, WPF

Pingbacks and trackbacks (2)+

Comments are closed