Skip to main content

ColorPicker

Namespace: Wisej.Web.Ext.Syncfusion2

Assembly: Wisej.Web.Ext.Syncfusion2 (4.1.0.0)

A control that lets the user pick a color.

public class ColorPicker : ej2Base

Constructors​

Instance member ColorPicker()​

Constructs a new instance of the ColorPicker class.

Example:

The following example creates a color picker that shows the color palette and sets the initial color through the Options object.

var colorPicker = new ColorPicker();
colorPicker.Options.mode = "Palette";
colorPicker.Options.value = "#1e88e5ff";
this.Controls.Add(colorPicker);

Instance member ColorPicker(options)​

Constructs a new instance of the ColorPicker class.

NameTypeDescription
optionsObjectInitial set of options.

Example:

The following example creates a color picker that cannot be switched to the palette and that applies the selected color only when the user confirms it.

var colorPicker = new ColorPicker(new
{
value = "#ff5722ff",
mode = "Picker",
modeSwitcher = false,
showButtons = true
});
this.Controls.Add(colorPicker);

Properties​

Instance member Text​

String: Returns or sets the color of the ColorPicker as a string. (Default: "")

The property reads and writes the value option of the widget, which holds the color in hexadecimal format including the opacity, i.e. #ff5722ff. Setting the property always fires the TextChanged event.

The property is not updated when the user selects a color in the browser. To receive the color selected by the user, handle the change event of the widget.

Example:

this.colorPicker1.Text = "#ff5722ff";

// receive the color selected by the user.
this.colorPicker1.Instance.onChange += new WidgetEventHandler((s, e) =>
{
string color = e.Data.currentValue.hex;
AlertBox.Show($"Selected {color}");
});

Implements​