Selection Property Editing Context - kaisu1986/ATF GitHub Wiki
Property editors show properties for selected items, so property editing is context dependent. The key interface for contexts is ISelectionContext
, which provides properties and methods to get the selected items and last selected item, change the selection, and so forth. ISelectionContext
also provides events for selection changes: SelectionChanging
and SelectionChanged
. Raising these events allows selections to be tracked and the properties of selected items obtained for property editors.
The SelectionPropertyEditingContext
class supports property editing on any ISelectionContext
. SelectionPropertyEditingContext
implements IPropertyEditingContext
, which is for contexts in which properties can be edited by controls, such as PropertyGrid
and GridControl
, on which the components PropertyEditor
and GridPropertyEditor
are built.
IPropertyEditingContext
defines two properties:
-
Items
: Get an enumeration (IEnumerable<object>
) of the selected items that have editable properties. -
PropertyDescriptors
: Get an enumeration (IEnumerable<PropertyDescriptor>
) of the property descriptors for selected items. These are the property descriptors common to all items in the selection.
ISelectionContext
interface are raised.
Thus the context can provide a collection of property descriptors whose properties all apply to the current selection. Each property descriptor, in turn, provides all the information needed to edit its property.