WPF PropertyGrid Control
: The project has moved to GitHub. You can get access to the most recent sources
WPF PropertyGrid control follows the .Net Windows Forms and Expression Blend PropertyGrid paradigms. It was written in the way to reduce development efforts for customization and supports a variety of features required to cover different scenarios.
The most remarkable features of WPF PropertyGrid controls are as follows:
- Categorized properties view
- Alphabetical properties view
- Extended editor tabs (unique feature)
This is a unique feature allowing you opening property editors within separate property tabs. You can have a “Basic” or inline editor covering most common scenarios and “Extended” editor providing more complex UI. Each extened editor occupies full separate
Tab and can be closed by user (there’s a way restricting tabs to be closed if required). It is supported natively by default Tabbed Layout however PropertyGrid model allows you implementing your own Views that suport this very feature.
For example entering "extended" mode for "Login" property:
Editing property value within a separate property tab that can be closed at any moment:
Upon closing the "extended editor" tab user is navigated back to the categorized or alphabetical view:
Note that extended editor tab can contain any type of the UI. It is possible to provide rich property editing capabilities and avoid modal dialogs approach.
Dialog editors are also supported. You can embed dialog logic into your custom editors or intercept dialog calls in order to provide external editing support within your application.
- Multiple objects selection
Both single and multiple objects selection is fully supported. Categories (if property grid is set to Categorized mode) preserve their viewstates when changing amount of objects selected or switching between different objects. MergablePropertyAttribute is supported
for scenarios when there’s a need to exclude some of the properties from multi-selection editing.
- Rich infrastructure for managing property and category editors
There are several ways declaring editors for your business objects or view models. You can declare an editor for a Type, for single property of the Type or an editor for the whole category. Editors can be declared via XAML, code behind or custom attributes.
Besides edited value each editor has access to owning property grid control and all the metadata (custom attributes the edited property is marked with). It is easy binding controls in editor template directly to metadata values (like marking property with
some Range attribute and binding Slider editor values to Range.Minimum and Range.Maximum). Category Editor control parts can be easily bound to different properties directly from XAML.
There is a set of default common types editors. The ways introducing custom editors for properties and categories as long as organizing editor control templates are extremely easy and vary.
- More Access Over Property Items and Categories
It is possible gaining explicit control over properties regardless initial property state. You can control whether and when to show or hide any property (especially usefull when introducing conditionally visible properties or complex editors). The same goes
for Categories. PropertyGrid provides effient infrastucture accessing properties and items by names either from code behind or XAML. Object model allows you configuring properties and categories easily. There is a set of attributes that allow defining property
orders, controlling visibility of properties/categories without having access to them and without the need to override/replace properties of parent Type just in order to mark them with some attribute.
PropertyGrid allows you configuring different Views for your business objects. You can choose whether to use a single or multiple views (Property Tabs) within your application. By default there are three modes supported: Categorized, Alphabetical and Tabbed
layouts. Tabbed Layout allows you combining Views on several pages. You can totally replace PropertyGrid presentation with a custom View based on existing infrastructure. Developer guide will give you a sample on how to display each Category of the the edited
object in a separate property tab easily just by modifying XAML markup in your application.
No theme is applied by default so it is easy to apply internal corporate or custom themes. Extenal themes were moved to a separate “Themes” assembly (by default version 2.0 supports original black also known as “Kaxaml” theme). Each theme can be applied either
to PropertyGrid or overall Window/Application.
- Expression Blend-like property filter box
As it can be seen from the screenshots above a brand new property filter box was introduced in this version. It occupies less space and can be switched of/on by means of appropriate properties from either XAML or code. Like Expression Blend, property filtering
supports filtering both by property display names and property types.
Full support for custom categories. It is now possible providing any layout for the whole category. Layoutting procedure is as close as possible to Microsoft custom categories guides. The screenshot below demonstrates custom category layout copy-pasted from
MSDN site: “Walkthrough: Creating a Category Editor
And a lot of other features.