API Reference: EditorAttribute Class

The EditorAttribute can be applied to content properties. The attribute specifies the editor type to use for the property. Use this to override the Redakt default selected editor type for the property type, or to set a custom editor type.

If EditorAttribute is not specified, the content property will use the default property editor by convention unless other configuration or attributes are used to specify an editor.

Forcing an editor for a property that does not support the type can cause errors in your application and is generally not a good idea. For example, using a textbox editor for an integer type may result in exceptions if the value cannot be converted to an integer.

Usage

Decorate the page model class with the EditorAttribute. Pass the editor type in the constructor.

Example

public class RssFeed: IContentType
{
    // Forces a numeric editor for a string property
    [Editor(typeof(NumberEditor))]
    public string Count { get; set; }

    // Sets a custom editor for a custom type
    [Editor(typeof(MyCustomEditor))]
    public MyCustomType MyValue { get; set; }
}