In This Article

ColorPicker Class

Represents a color picker control.

[TemplatePart(Name = "PART_Component1EditBox", Type = typeof(Int32EditBox))]
[TemplatePart(Name = "PART_Component2EditBox", Type = typeof(Int32EditBox))]
[TemplatePart(Name = "PART_Component3EditBox", Type = typeof(Int32EditBox))]
public class ColorPicker : PickerBase
Inheritance:
object Visual UIElement FrameworkElement Control PickerBase object

Constructors

ColorPicker()

Initializes an instance of the class.

public ColorPicker()

Properties

A

The alpha transparency component (0 - 255) of the Value.

public int A { get; set; }

Property Value

int

B

The RGB blue component (0 - 255) of the Value.

public int B { get; set; }

Property Value

int

Brightness

The HSB brightness component (0 - 1.0) of the Value.

public double Brightness { get; set; }

Property Value

double

ComparisonValue

The comparison color.

public Color ComparisonValue { get; set; }

Property Value

Color

Component1SwatchBrush

The Brush to render in the component 1 swatch.

public Brush? Component1SwatchBrush { get; }

Property Value

Brush

Component2SwatchBrush

The Brush to render in the component 2 swatch.

public Brush? Component2SwatchBrush { get; }

Property Value

Brush

Component3SwatchBrush

The Brush to render in the component 3 swatch.

public Brush? Component3SwatchBrush { get; }

Property Value

Brush

DegreeInlineTemplate

The DataTemplate with inline content for a degree glyph.

public DataTemplate? DegreeInlineTemplate { get; set; }

Property Value

DataTemplate

G

The RGB green component (0 - 255) of the Value.

public int G { get; set; }

Property Value

int

HasColorEditBox

Indicates whether an embedded ColorEditBox should appear in the picker for hex-based color entry.

public bool HasColorEditBox { get; set; }

Property Value

bool:

true if an embedded ColorEditBox should appear in the picker for hex-based color entry; otherwise, false. The default value is true.

Hue

The HSB hue component (0 - 359.00) of the Value.

public double Hue { get; set; }

Property Value

double

IsAlphaEnabled

Indicates whether the alpha channel (transparency) of the color value is enabled.

public bool IsAlphaEnabled { get; set; }

Property Value

bool:

true if the alpha channel (transparency) of the color value is enabled; otherwise, false. The default value is true.

Remarks

When disabled, no transparency is supported.

IsComparisonValueVisible

Indicates whether the comparison value is visible.

public bool IsComparisonValueVisible { get; set; }

Property Value

bool:

true if the comparison value is visible; otherwise false. The default value is false.

IsEditable

Indicates whether the edit box text areas within the control are editable.

public bool IsEditable { get; set; }

Property Value

bool:

true if the edit box text areas within the control are editable; otherwise false. The default value is true.

Remarks

When false, the edit boxes behave more like a ComboBox.

PercentInlineTemplate

The DataTemplate with inline content for a percent glyph.

public DataTemplate? PercentInlineTemplate { get; set; }

Property Value

DataTemplate

R

The RGB red component (0 - 255) of the Value.

public int R { get; set; }

Property Value

int

Saturation

The HSB saturation component (0 - 1.0) of the Value.

public double Saturation { get; set; }

Property Value

double

TextInputMode

The text input mode of the picker.

public ColorPickerTextInputMode TextInputMode { get; set; }

Property Value

ColorPickerTextInputMode

Value

The selected color.

public Color? Value { get; set; }

Property Value

Color?

Methods

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

Events

ValueChanged

Occurs after the Value property value changes.

public event EventHandler? ValueChanged

Event Type

EventHandler

Fields

AProperty

Defines the A property.

public static readonly DependencyProperty AProperty

BProperty

Defines the B property.

public static readonly DependencyProperty BProperty

BrightnessProperty

Defines the Brightness property.

public static readonly DependencyProperty BrightnessProperty

ComparisonValueProperty

Defines the ComparisonValue property.

public static readonly DependencyProperty ComparisonValueProperty

Component1SwatchBrushProperty

Defines the Component1SwatchBrush property.

public static readonly DependencyProperty Component1SwatchBrushProperty

Component2SwatchBrushProperty

Defines the Component2SwatchBrush property.

public static readonly DependencyProperty Component2SwatchBrushProperty

Component3SwatchBrushProperty

Defines the Component3SwatchBrush property.

public static readonly DependencyProperty Component3SwatchBrushProperty

DegreeInlineTemplateProperty

Defines the DegreeInlineTemplate property.

public static readonly DependencyProperty DegreeInlineTemplateProperty

GProperty

Defines the G property.

public static readonly DependencyProperty GProperty

HasColorEditBoxProperty

Defines the HasColorEditBox property.

public static readonly DependencyProperty HasColorEditBoxProperty

HueProperty

Defines the Hue property.

public static readonly DependencyProperty HueProperty

IsAlphaEnabledProperty

Defines the IsAlphaEnabled property.

public static readonly DependencyProperty IsAlphaEnabledProperty

IsComparisonValueVisibleProperty

Defines the IsComparisonValueVisible property.

public static readonly DependencyProperty IsComparisonValueVisibleProperty

IsEditableProperty

Defines the IsEditable property.

public static readonly DependencyProperty IsEditableProperty

PercentInlineTemplateProperty

Defines the PercentInlineTemplate property.

public static readonly DependencyProperty PercentInlineTemplateProperty

RProperty

Defines the R property.

public static readonly DependencyProperty RProperty

SaturationProperty

Defines the Saturation property.

public static readonly DependencyProperty SaturationProperty

TextInputModeProperty

Defines the TextInputMode property.

public static readonly DependencyProperty TextInputModeProperty

ValueProperty

Defines the Value property.

public static readonly DependencyProperty ValueProperty

Inherited Members

Extension Methods