ColorPicker
ColorPicker
Overview
Features
Sample
Settings
Description
This sample shows the basic usage of the ColorPicker control.
Source
IndexController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MvcExplorer.Models; namespace MvcExplorer.Controllers { public partial class ColorPickerController : Controller { public ActionResult Index() { ViewBag.DemoSettings = true; ViewBag.DemoSettingsModel = new ClientSettingsModel { Settings = CreateSettings() }; return View(); } private static IDictionary<string, object[]> CreateSettings() { var settings = new Dictionary<string, object[]> { {"ShowAlphaChannel", new object[]{true, false}}, {"ShowColorString", new object[]{false, true}} }; return settings; } } }
Index.cshtml
@using System.Drawing @{ ClientSettingsModel settings = ViewBag.DemoSettingsModel; } <div> <label>@Html.Raw(Resources.ColorPicker.Index_ColorPicker)</label> @Html.C1().ColorPicker().Id(settings.ControlId).Palette(Color.Red, Color.Green, Color.Blue).Width(400) </div> @section Description{ @Html.Raw(Resources.ColorPicker.Index_Text0) }
Documentation