Skip to content

Property Editor Components

gstaas edited this page Oct 3, 2014 · 7 revisions

Table of Contents

Several editors are MEF components. They are built on top of other controls to provide their capabilities.

Property Editor Containers

Several components encapsulate value editing controls. Many of the samples, such as ATF Timeline Editor Sample, use both of these components, described below, to show different views of properties.

GridPropertyEditor Component

The GridPropertyEditor component displays items with properties in a spreadsheet type control, allowing you to see the properties of all selected items. On the other hand, you can't see categories or child properties with this control, because there is only one line per property. This figure shows a GridPropertyEditor used in the ATF Timeline Editor Sample with several items selected:

Like the ListViewEditor Component, GridPropertyEditor provides a Configure() method to set up the component and can be overridden to configure the control differently, such as with a different kind of grid control:

protected virtual void Configure(out GridControl gridControl, out ControlInfo controlInfo)
{
    gridControl = new GridControl();
    controlInfo = new ControlInfo(
        "Grid Property Editor".Localize(),
        "Edits selected object properties".Localize(),
        StandardControlGroup.Bottom);
}

GridPropertyEditor is built on top of the GridControl class, which is a wrapper for the spreadsheet-style GridView control class, combining it with a toolbar. You can use GridControl as a replacement for the .NET System.Windows.Forms.DataGridView control.

GridView is a spreadsheet-like control for displaying properties of many objects simultaneously. Only properties that are in common with all selected objects are displayed.

GridView is the real work horse of the GridPropertyEditor component, providing most of its functionality. GridView derives from PropertyView, which also provides capabilities.

PropertyEditor Component

The PropertyEditor component displays items with properties in a two-column control, so you can see the properties of only one selected item. On the other hand, you can see categories and child properties with this control, because it is a multi-line control. This figure shows a PropertyEditor used in the ATF Timeline Editor Sample with one of the selected items shown in the previous figure:

This editor has a button () that resets all properties to their default values, if the property has one. Selecting an individual property also displays this button for many of the value editors, allowing you to reset this individual property to its default.

Like ListViewEditor and GridPropertyEditor, PropertyEditor provides a Configure() method to set up the component and can be overridden to configure the control differently, such as with a different kind of property grid control:

protected virtual void Configure(out PropertyGrid propertyGrid, out ControlInfo controlInfo)
{
    propertyGrid = new PropertyGrid();
    controlInfo = new ControlInfo(
        "Property Editor".Localize(),
        "Edits selected object properties".Localize(),
        StandardControlGroup.Right);
}

PropertyEditor is built on top of PropertyGrid, which is a wrapper for the two-column PropertyGridView control class, combining it with a toolbar. You can use PropertyGrid as a replacement for the .NET System.Windows.Forms.PropertyGrid control.

PropertyGridView is a control for displaying properties in a two column grid, with property names on the left and property values on the right. Properties with associated IPropertyEditor instances can embed controls into the right column, while all other properties are edited in a standard .NET way with a PropertyEditingControl.

PropertyEditingControl is a universal property editing control that can be embedded in complex property editing controls. It uses TypeConverter and UITypeEditor objects to provide a GUI for every kind of .NET property. It is used by default if no custom value editing control is provided.

PropertyGridView does most of the work of the PropertyEditor component. PropertyGridView derives from PropertyView, which also provides capabilities.

PropertyView Class

The GridView and PropertyGridView classes are the underlying controls that provide most of the functionality of the GridPropertyEditor and PropertyEditor components. Both derive from the abstract class PropertyView, which also provides fundamental capabilities.

PropertyView is a class for embedding complex property editing controls. It provides formats, fonts, data binding, property sorting, persistent settings of property editor layouts, and category/property information.

PropertyView helps handle the selection of items with properties in the application, tracking the active context. In response to selection events, PropertyView builds property descriptor lists of the common properties of selected items. It gets the value editor and value editing control for a property descriptor in the list of descriptors.

Property changes occur in a ITransactionContext in PropertyView, so that property changes can be undone and redone.

PropertyEditingCommands Component

PropertyEditingCommands provide property editing commands in a context menu that can be used inside property editor controls like PropertyGrid. PropertyEditingCommands can be used with ATF property editors or with custom property editors. It provides:

  • Copy Property: Copy this property's value to the local clipboard.
  • Paste Property: Paste the local clipboard into this property's value.
  • Reset Property: Reset the current property to its default value.
  • Copy All: Copy all properties to the local clipboard.
  • Paste All: Paste the local clipboard into all properties.
  • Reset All: Reset all properties to their default values.
  • View In Text Editor: Open the file in the associated text editor.

CurveEditor Component

You can use this component to edit curves. It integrates CurveEditingControl with ControlHostService and adds event handling. You can easily use some other curve editing control with CurveEditor.

For an example of using it, see the ATF DOM Tree Editor Sample, whose curve editing window is shown in this illustration:

For details on the Curve Editor, see ATF Curve Editor User and Programming Guide.

ListViewEditor Component

ListViewEditor serves as a base class for list editors. It is not abstract, so it can be used as a generic list editor.

It creates a System.Windows.Forms.ListView control as its list view. It also creates a ListViewAdapter to adapt the ListView to an IListView interface, which enumerates objects that can be used in each row of the ListView.

Like the GridPropertyEditor and PropertyEditor components, its Configure() method sets up the component and can be overridden to configure the list differently, such as with a different kind of list control or adapter:

protected virtual void Configure(
    out ListView listView,
    out ListViewAdapter listViewAdapter)
{
    listView = new ListView();
    listView.SmallImageList = ResourceUtil.GetImageList16();
    listView.LargeImageList = ResourceUtil.GetImageList32();

    listViewAdapter = new ListViewAdapter(listView);
}

ListViewEditor offers a variety of other services to the control, such as setting up event handling and persistence for the list layout.

Topics in this section

Clone this wiki locally