net472_PropertyGridHelpers.UIEditors_ImageTextUIEditor 1 - dparvin/PropertyGridHelpers GitHub Wiki

ImageTextUIEditor<T> class

A generic UITypeEditor that displays an enumeration with both images and localized text in a drop-down list.

public class ImageTextUIEditor<T> : ImageTextUIEditor
    where T : struct, Enum
parameter description
T The enumeration type to be edited. This must be a value type constrained to an Enum (except on .NET Framework 3.5).

Public Members

name description
ImageTextUIEditor() Initializes a new instance of the ImageTextUIEditor class.
ImageTextUIEditor(…) Initializes a new instance of the ImageTextUIEditor class.

Remarks

This class extends ImageTextUIEditor and uses the specified generic enum type T to simplify application and enforce type safety. It supports localized display names via LocalizedEnumTextAttribute and image rendering via EnumImageAttribute.

This editor is useful for properties where both textual meaning and visual context help the user choose the correct value.

Examples

To use this editor for an enum named ButtonStyle, define your enum with attributes:

public enum ButtonStyle
{
    [EnumText("Flat"), EnumImage("FlatIcon")]
    Flat,
    [EnumText("Raised"), EnumImage("RaisedIcon")]
    Raised,
    [EnumText("3D"), EnumImage("ThreeDIcon")]
    ThreeD
}

Then apply the editor to your property:

[Editor(typeof(ImageTextUIEditor<ButtonStyle>), typeof(UITypeEditor))]
public ButtonStyle Style { get; set; }

See Also

⚠️ **GitHub.com Fallback** ⚠️