Johan
Johan

Reputation: 670

Alias for EditorAttribute

Is there a way to create a shorter alias for an EditorAttribute? Instead of:

    [EditorAttribute(typeof<ColorPickerDialogPropertyValueEditor>, typeof<DialogPropertyValueEditor>)]
    public Color4 Color { get; set; }

I would like to write:

    using ColorPicker = EditorAttribute(typeof<ColorPickerDialogPropertyValueEditor>, typeof<DialogPropertyValueEditor>)
    [ColorPicker]
    public Color4 Color { get; set; }

Unfortunately the EditorAttribute class is sealed so I cannot inherit it.

Upvotes: 1

Views: 484

Answers (1)

EgorBo
EgorBo

Reputation: 6142

I see only one way:

using CPDPEditor = YourNamespace.ColorPickerDialogPropertyValueEditor;
using DPEditor = YourNamespace.DialogPropertyValueEditor;

...

[Editor(typeof(CPDPEditor), typeof(DPEditor))]

Or maybe the AttributeProvider will help you (dont know how)

Upvotes: 2

Related Questions