PropertyGrid for WPF | ComponentOne
In This Topic
    Editors
    In This Topic

    PropertyGrid provides a variety of built-in editors and also allows you to create custom editors. Let us discuss about these editors in detail in the following sections.

    Built-in Editors

    The PropertyGrid control includes several built-in editors. If you do not specify an editor, PropertyGrid displays each member with a default editor. Hence, you can specify editors based on your requirements and also create your own custom editor, if needed. PropertyGrid provides the AvailableEditors property in the C1PropertyGrid class, which provides you a list of all the built-in editors available in the PropertyGrid control.

    The following table lists the built-in editors available in PropertyGrid.

    Editor Description
    BoolEditor Default editor used by C1PropertyGrid to edit Boolean values.
    BrushEditor Default editor used by C1PropertyGrid to edit Brush values.
    ColorPaletteEditor Default editor used by C1PropertyGrid to edit color palette values.
    EnumEditor Default editor used by C1PropertyGrid to edit Enum values.
    ImageSourceEditor Default editor used by C1PropertyGrid to edit image values.
    NumericEditor Default editor used by C1PropertyGrid to edit numeric values.
    StringEditor Default editor used by C1PropertyGrid to edit String values.
    UriEditor Default editor used by C1PropertyGrid to edit Uri values.

    Back to Top

    Custom Editors

    As the built-in editors in PropertyGrid control are unable to support complex objects, these objects are shown in the default editor (StringEditor). Hence, you may want to create a custom editor to show complex objects so that it fits your needs. You can easily create your own editors to use with the PropertyGrid control. To do so, follow these simple steps:

    1. Create a class that implements the IPropertyGridEditor interface.
    2. Add an instance of this class to the AvailableEditors collection on the PropertyGrid control or specify this class as the editor for a specific property by adding an EditorAttribute to the property definition.

    The IPropertyGridEditor interface contains the following members:

    To understand how to create your own custom editor programmatically, see the Nested Properties topic.

    Back to Top