ColorEditFor

ColorEditFor represents a color editor control that has a dropdown window with a color palette.

Implementation Details

ColorEditFor is realized by the ColorEditExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.ColorEditFor<ValueType> helper method, which is used to add a ColorEditFor extension to a view. This first method's parameter is an expression that identifies model property to display and edit. The second method's parameter provides access to the ColorEditFor's settings implemented by the ColorEditSettings class, allowing you to fully customize the extension.

ColorEditFor's client counterpart is represented by the ASPxClientColorEdit object.

Declaration

ColorEditFor can be added to a view in the following manner.

View code (Razor):

@Html.DevExpress().ColorEditFor(model => model.BackColor,
    settings => {
        settings.Color = System.Drawing.Color.FromName("red");
    }).GetHtml()

The code result is demonstrated in the image below.

coloredit-declaration.png

See Also