dxColorBox
Namespace: Wisej.Web.Ext.DevExtreme
Assembly: Wisej.Web.Ext.DevExtreme (4.1.0.0)
The ColorBox is a widget that allows an end user to enter a color or pick it out from the drop-down editor.
- C#
- VB.NET
public class dxColorBox : dxBase
Public Class dxColorBox
Inherits dxBase
Constructors
dxColorBox()
Constructs a new instance of the dxColorBox class.
Example:
The following example creates a color box and sets the initial color.
var colorBox = new dxColorBox();
colorBox.Options.value = "#f05b41";
colorBox.Options.applyValueMode = "instantly";
colorBox.Size = new Size(200, 36);
this.Controls.Add(colorBox);
dxColorBox(options)
Constructs a new instance of the dxColorBox class.
| Name | Type | Description |
|---|---|---|
| options | Object | Initial set of options. |
Example:
The following example creates a color box that also lets the user edit the opacity of the color.
var colorBox = new dxColorBox(new
{
value = "rgba(240, 91, 65, 0.5)",
editAlphaChannel = true
});
colorBox.Size = new Size(200, 36);
this.Controls.Add(colorBox);
Properties
Text
String: Returns or sets the color of the dxColorBox as a text value. (Default: "")
This property reads and writes the value option in Options. The value is a color in one of the formats accepted by the widget, i.e. "#f05b41" or "rgba(240, 91, 65, 0.5)". It returns an empty string when the option is not set.
The color picked by the user in the browser is not written back to this property automatically: handle the valueChanged event of the widget to receive it.
Example:
The following example sets the color and keeps the property in sync with the color picked by the user.
this.dxColorBox1.Text = "#f05b41";
this.dxColorBox1.Instance.onValueChanged += new WidgetEventHandler((s, e) =>
{
this.dxColorBox1.Text = e.Data.value;
});