Color Properties
- 2 minutes to read
XAF displays the Color and Nullable<Color>
properties using a combo box (ASP.NET Core Blazor) or a drop-down window with a color table / color picker (Windows Forms and ASP.NET Web Forms).
Examples
ASP.NET Core Blazor
XAF’s ASP.NET Core Blazor UI implements ColorPropertyEditor
to display Color properties.
In ASP.NET Core Blazor, BlazorPropertyEditorBase.ComponentModel returns an IComponentModel
descendant that wraps properties and events of a corresponding ASP.NET Core Blazor Editor.
The code sample below demonstrates how to apply a custom CSS class to all ColorPropertyEditor
controls in the application.
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Blazor.Editors;
namespace YourSolutionName.Blazor.Server.Controllers {
public class CustomizeColorPropertiesController : ViewController {
protected override void OnActivated() {
base.OnActivated();
if (View is ListView { Editor: DxGridListEditor gridListEditor }) {
gridListEditor.CustomizeViewItemControl<ColorPropertyEditor>(this, ConfigureColorEdit);
}
else if (View is DetailView detailView) {
detailView.CustomizeViewItemControl<ColorPropertyEditor>(this, ConfigureColorEdit);
}
}
private void ConfigureColorEdit(ColorPropertyEditor propertyEditor) {
propertyEditor.ComponentModel.CssClass = "myCustomCss";
}
}
}
Windows Forms
XAF’s Windows Forms UI implements ColorPropertyEditor
to display Color properties.
Each Windows Forms Property Editor is available in two forms:
- A standalone control (displays property value in a Detail View)
- A repository item (displays property value in a List Editor that supports in-place editing)
Control | Repository Item | Description |
---|---|---|
Displays Color properties. Use Alt + Down Arrow to expand the editor’s drop-down window. |
ASP.NET Web Forms
XAF’s ASP.NET Web Forms UI supports two Property Editors to display Color properties (new and legacy implementations).
Each ASP.NET Web Forms Property Editor includes controls that display a property in a Detail View in View and Edit mode.
Property Editor | Description | View Mode Control | Edit Mode Control |
---|---|---|---|
| Allows users to select a color from a drop-down window with a color table or use the color picker to specify a custom color. | The | |
| Displays Color properties in legacy applications. To switch to |
|