New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Defines the fluent API for configuring the Kendo UI ColorPicker

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class ColorPickerBuilder : MvvmWidgetBuilderBase<ColorPicker, ColorPickerBuilder>, IHtmlContent

Inheritance: objectHelperResultWidgetBuilderBase<ColorPicker, ColorPickerBuilder>MvvmWidgetBuilderBase<ColorPicker, ColorPickerBuilder>ColorPickerBuilder

Implements: IHtmlContent

Inherited Members MvvmWidgetBuilderBase<ColorPicker, ColorPickerBuilder>.UseMvvmInitialization(bool)MvvmWidgetBuilderBase<ColorPicker, ColorPickerBuilder>.UseMvvmInitialization()WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.ToComponent()WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.Expression(string)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.Explorer(ModelExplorer)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.Name(string)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.Deferred(bool)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.HtmlAttributes(object)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.ScriptAttributes(object, bool)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.Render()WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.ToHtmlString()WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.WriteTo(TextWriter, HtmlEncoder)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.ToClientTemplate()WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.AsModule(bool)WidgetBuilderBase<ColorPicker, ColorPickerBuilder>.ComponentWidgetBuilderBase<ColorPicker, ColorPickerBuilder>.ContainerHelperResult.WriteTo(TextWriter, HtmlEncoder)HelperResult.WriteActionobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the ColorPickerBuilder class.

C#
public ColorPickerBuilder(ColorPicker component)
Parameters:componentColorPicker

Methods

Specifies the adaptive rendering of the component.

C#
public ColorPickerBuilder AdaptiveMode(AdaptiveMode value)
Parameters:valueAdaptiveMode

The value for AdaptiveMode

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Allows customization of the subtitle's text in the adaptive view of the component.

C#
public ColorPickerBuilder AdaptiveSubtitle(string value)
Parameters:valuestring

The value for AdaptiveSubtitle

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Allows customization of the title's text in the adaptive view of the component.

C#
public ColorPickerBuilder AdaptiveTitle(string value)
Parameters:valuestring

The value for AdaptiveTitle

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Specifies whether the widget should display the Apply / Cancel buttons.

C#
public ColorPickerBuilder Buttons(bool value)
Parameters:valuebool

The value for Buttons

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.Buttons(false)
)

Specifies the template which is used for rendering the action buttons.

C#
public ColorPickerBuilder ButtonsTemplate(string value)
Parameters:valuestring

The value for ButtonsTemplate

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Specifies the template which is used for rendering the action buttons.

C#
public ColorPickerBuilder ButtonsTemplate<TModel>(TemplateBuilder<TModel> template)
Parameters:templateTemplateBuilder<TModel>

A Template component that configures the buttonstemplate.

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Specifies the template which is used for rendering the action buttons.

C#
public ColorPickerBuilder ButtonsTemplateHandler(string templateHandler)
Parameters:templateHandlerstring

The handler that returs the template for ButtonsTemplate

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Specifies the template which is used for rendering the action buttons.

C#
public ColorPickerBuilder ButtonsTemplateId(string templateId)
Parameters:templateIdstring

The ID of the template element for ButtonsTemplate

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Specifies the template which is used for rendering the action buttons.

C#
public ColorPickerBuilder ButtonsTemplateView(IHtmlContent templateView)
Parameters:templateViewIHtmlContent

The view that contains the template for ButtonsTemplate

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Specifies whether the widget should display the 'Clear color' button.

C#
public ColorPickerBuilder ClearButton()
Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Specifies whether the widget should display the 'Clear color' button.

C#
public ColorPickerBuilder ClearButton(bool value)
Parameters:valuebool

The value for ClearButton

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.ClearButton(true)
)

Specifies whether selection of a color in the palette view closes the popup. Applied only when buttons are set to false and the currently selected view is palette.

C#
public ColorPickerBuilder CloseOnSelect()
Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Specifies whether selection of a color in the palette view closes the popup. Applied only when buttons are set to false and the currently selected view is palette.

C#
public ColorPickerBuilder CloseOnSelect(bool value)
Parameters:valuebool

The value for CloseOnSelect

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.CloseOnSelect(true)
)

The number of columns to show in the color dropdown when a pallete is specified. This is automatically initialized for the "basic" and "websafe" palettes. If you use a custom palette then you can set this to some value that makes sense for your colors.

C#
public ColorPickerBuilder Columns(double value)
Parameters:valuedouble

The value for Columns

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.Columns(3)
)

Enables the contrast tool in the ColorGradient.

C#
public ColorPickerBuilder ContrastTool()
Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerContrastToolSettingsBuilder .

Enables the contrast tool in the ColorGradient.

C#
public ColorPickerBuilder ContrastTool(Action<ColorPickerContrastToolSettingsBuilder> configurator)
Parameters:configuratorAction<ColorPickerContrastToolSettingsBuilder>

The ColorPickerContrastToolSettingsBuilder for the contrasttool setting.

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder .

Enables the contrast tool in the ColorGradient.

C#
public ColorPickerBuilder ContrastTool(bool enabled)
Parameters:enabledbool

Enables or disables the contrasttool option.

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerContrastToolSettingsBuilder .

Enables or disables the picker.

C#
public ColorPickerBuilder Enable(bool value)
Parameters:valuebool

Whether the picker is enabled

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder for method chaining.

Example:
C#
@( Html.Kendo().ColorPicker()
.Name("ColorPicker")
.Enable(false)
)

Configures the client-side events.

C#
public ColorPickerBuilder Events(Action<ColorPickerEventBuilder> configurator)
Parameters:configuratorAction<ColorPickerEventBuilder>

The client events action.

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("ColorPicker")
.Events(events =&gt; events
.Change("onChange")
)
)

Sets a value controlling how the color is applied.

C#
public ColorPickerBuilder FillMode(FillMode value)
Parameters:valueFillMode

The value for FillMode

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.FillMode(FillMode.Solid)
)

Defines the format of the gradient input editor.

C#
public ColorPickerBuilder Format(ColorPickerFormat value)
Parameters:valueColorPickerFormat

The value for Format

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.Format(ColorPickerFormat.Hex)
)

Sets the available input formats in the gradient input editor.

C#
public ColorPickerBuilder Formats(params string[] formats)
Parameters:formatsstring[]

Only "hex" and "rgb" are valid values.

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder for method chaining.

Example:
C#
@( Html.Kendo().ColorPicker()
.Name("ColorPicker")
.Formats(new string[]{ "rgb", "hex" })
)

Whether to render the input in the ColorGradient component.

C#
public ColorPickerBuilder Input(bool value)
Parameters:valuebool

The value for Input

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.Input(true)
)

Allows localization of the strings that are used in the widget.

C#
public ColorPickerBuilder Messages(Action<ColorPickerMessagesSettingsBuilder> configurator)
Parameters:configuratorAction<ColorPickerMessagesSettingsBuilder>

The ColorPickerMessagesSettingsBuilder for the messages setting.

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder .

Only for the HSV selector. If true, the widget will display the opacity slider. Note that currently in HTML5 the <input type="color"> does not support opacity.

C#
public ColorPickerBuilder Opacity()
Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Only for the HSV selector. If true, the widget will display the opacity slider. Note that currently in HTML5 the <input type="color"> does not support opacity.

C#
public ColorPickerBuilder Opacity(bool value)
Parameters:valuebool

The value for Opacity

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.Opacity(true)
)

Defines the palettes that can be used in the color picker.

C#
public ColorPickerBuilder Palette(ColorPickerPalette value)
Parameters:valueColorPickerPalette

The value for Palette

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@( Html.Kendo().ColorPicker()
.Name("ColorPicker")
.Palette(ColorPickerPalette.WebSafe)
)

Sets the range of colors that the user can pick from.

C#
public ColorPickerBuilder Palette(params string[] palette)
Parameters:palettestring[]

A list of colors.

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder for method chaining.

Example:
C#
@( Html.Kendo().ColorPicker()
.Name("ColorPicker")
.Palette(new List&lt;string&gt; { "#ff0000", "#00ff00", "#0000ff" })
)

Displays the color preview element and the previously selected color for comparison. With buttons set to false, both elements will update at the same time.

C#
public ColorPickerBuilder Preview(bool value)
Parameters:valuebool

The value for Preview

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.Preview(true)
)

Sets a value controlling the border radius.

C#
public ColorPickerBuilder Rounded(Rounded value)
Parameters:valueRounded

The value for Rounded

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.Rounded(Rounded.Full)
)

Sets the size of the component.

C#
public ColorPickerBuilder Size(ComponentSize value)
Parameters:valueComponentSize

The value for Size

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.Size(ComponentSize.Medium)
)

The size of a color cell.

C#
public ColorPickerBuilder TileSize(Action<ColorPickerTileSizeSettingsBuilder> configurator)
Parameters:configuratorAction<ColorPickerTileSizeSettingsBuilder>

The ColorPickerTileSizeSettingsBuilder for the tilesize setting.

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder .

Sets the size of the palette tiles

C#
public ColorPickerBuilder TileSize(int tileSize)
Parameters:tileSizeint

The tile size (for square tiles)

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder for method chaining.

Example:
C#
@( Html.Kendo().ColorPalette()
.Name("ColorPalette")
.TileSize(32)
)

A CSS class name to display an icon in the color picker button. If specified, the HTML for the element will look like this:Set this option to an icon descriptor such as { name: "gear", variant: "outline" }. The variant can be outline, solid, or duotone; it applies to SVG rendering and is ignored for font icons.

C#
public ColorPickerBuilder ToolIcon(Action<ColorPickerToolIconSettingsBuilder> configurator)
Parameters:configuratorAction<ColorPickerToolIconSettingsBuilder>

The ColorPickerToolIconSettingsBuilder for the toolicon setting.

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder .

A CSS class name to display an icon in the color picker button. If specified, the HTML for the element will look like this:Set this option to an icon descriptor such as { name: "gear", variant: "outline" }. The variant can be outline, solid, or duotone; it applies to SVG rendering and is ignored for font icons.

C#
public ColorPickerBuilder ToolIcon(string toolIcon)
Parameters:toolIconstring

The value for ToolIcon

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder .

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.ToolIcon("gear")
)

The initially selected color. Note that when initializing the widget from an <input> element, the initial color will be decided by the field instead.

C#
public ColorPickerBuilder Value(string value)
Parameters:valuestring

The value for Value

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.Value("#b72bba")
)

Defines the initially selected view in the ColorPicker.

C#
public ColorPickerBuilder View(ColorPickerView value)
Parameters:valueColorPickerView

The value for View

Returns:

ColorPickerBuilder

Returns the current ColorPickerBuilder instance.

Example:
C#
@(Html.Kendo().ColorPicker()
.Name("palette")
.Views(new string[] { "palette"})
.View(ColorPickerView.Palette)
)

Sets the available views in the ColorPicker.

C#
public ColorPickerBuilder Views(params string[] views)
Parameters:viewsstring[]

Valid values are "gradient" and "palette".

Returns:

ColorPickerBuilder

Returns the current instance of ColorPickerBuilder for method chaining.

Example:
C#
@( Html.Kendo().ColorPicker()
.Name("ColorPicker")
.Views(new string[]{ "gradient", "palette" })
)