Editing Data Properties - kaisu1986/ATF GitHub Wiki
ATF provides several property editors that make it easy to edit data properties. The properties for each data type are the attributes defined in the data model. The steps for enabling property editing are described below.
When an item is selected, its property values appear in the property editors, and each attribute can be modified with an editor appropriate for its type. ATF handles selection events for you, so that property editors are automatically populated.
For a full discussion of properties in ATF, see Property Editing in ATF.
In the data model, define attributes for the properties you want to expose for each data type. In the ATF Simple DOM Editor Sample, the Type Definition topic shows an example of attributes defined for the "event" type: "name", "size", and "compressed".
ATF's property components allow you to display properties in several ways. For instance, the PropertyEditor
component displays the selected item's properties in a two-column control. For their description, see Property Editor Components. To import these components, simply include them in the MEF TypeCatalog
, as in this code from the Simple DOM Editor's Main
function:
var catalog = new TypeCatalog(
...
typeof(PropertyEditor), // property grid for editing selected objects
typeof(GridPropertyEditor), // grid control for editing selected objects
typeof(PropertyEditingCommands), // commands for PropertyEditor and GridPropertyEditor
...
);
You can use both styles of property editor components, as this samples does.
Property descriptors provide information that property editors need to display and edit property values. Such information includes the property name, and optionally, the type of editor to use to edit its value in the property editor. There are several kinds of property descriptors, but the most common is AttributePropertyDescriptor
that describes ordinary attribute properties.
To learn how the ATF Simple DOM Editor Sample defines descriptors, see Create Property Descriptors. For details on types of property descriptors and ways of creating them, see Property Descriptors in the Property Editing in ATF section.