In This Article

SpectrumColorPicker Class

Represents a hue spectrum color picker control.

public class SpectrumColorPicker : Control
Inheritance:
object Visual UIElement FrameworkElement Control object

Remarks

For detailed documentation on this control's features and how to use them, please see the Shared Color Selection documentation topic.

Constructors

SpectrumColorPicker()

Initializes an instance of the SpectrumColorPicker class.

public SpectrumColorPicker()

Properties

A

Gets or sets the ARGB alpha component of the SelectedColor.

public byte A { get; set; }

Property Value

byte:

The ARGB alpha component of the SelectedColor.

B

Gets or sets the RGB blue component of the SelectedColor.

public byte B { get; set; }

Property Value

byte:

The RGB blue component of the SelectedColor.

DisabledOpacity

Gets or sets the opacity used when the control is disabled.

public double DisabledOpacity { get; set; }

Property Value

double:

The opacity used when the control is disabled.

G

Gets or sets the RGB green component of the SelectedColor.

public byte G { get; set; }

Property Value

byte:

The RGB green component of the SelectedColor.

InitialColor

Gets or sets the Color that was initially selected in the picker.

public Color InitialColor { get; set; }

Property Value

Color:

The Color that was initially selected in the picker.

InitialColorBrush

Gets a Brush that uses the InitialColor. This is a dependency property.

public Brush InitialColorBrush { get; }

Property Value

Brush:

A Brush.

IsColorSwatchRowVisible

Gets or sets whether the color swatch row is visible in the color picker.

public bool IsColorSwatchRowVisible { get; set; }

Property Value

bool:

true if the color swatch row is visible in the color picker; otherwise, false. The default value is true.

IsInitialColorVisible

Gets or sets whether the initial color swatch is visible in the color picker.

public bool IsInitialColorVisible { get; set; }

Property Value

bool:

true if the initial color swatch is visible in the color picker; otherwise, false. The default value is true.

R

Gets or sets the RGB red component of the SelectedColor.

public byte R { get; set; }

Property Value

byte:

The RGB red component of the SelectedColor.

SelectedColor

Gets or sets the Color that is selected in the picker.

public Color SelectedColor { get; set; }

Property Value

Color:

The Color that is selected in the picker.

SelectedColorBrush

Gets a Brush that uses the SelectedColor. This is a dependency property.

public Brush SelectedColorBrush { get; }

Property Value

Brush:

A Brush.

SetColor

Gets the ICommand for setting a color.

public static ICommand SetColor { get; }

Property Value

ICommand:

The ICommand for setting a color.

Methods

OnApplyTemplate()

Invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnSelectedColorChanged(Color, Color)

Raises the SelectedColorChanged event.

protected virtual void OnSelectedColorChanged(Color oldValue, Color newValue)
Parameter Type Description
oldValue Color

The old value.

newValue Color

The new value.

Events

SelectedColorChanged

Occurs when the value of the SelectedColor property is changed.

public event RoutedPropertyChangedEventHandler<Color> SelectedColorChanged

Event Type

RoutedPropertyChangedEventHandler<Color>

Fields

AProperty

Identifies the A dependency property. This field is read-only.

public static readonly DependencyProperty AProperty

BProperty

Identifies the B dependency property. This field is read-only.

public static readonly DependencyProperty BProperty

DisabledOpacityProperty

Identifies the DisabledOpacity dependency property. This field is read-only.

public static readonly DependencyProperty DisabledOpacityProperty

GProperty

Identifies the G dependency property. This field is read-only.

public static readonly DependencyProperty GProperty

InitialColorBrushProperty

Identifies the read-only InitialColorBrush dependency property. This field is read-only.

public static readonly DependencyProperty InitialColorBrushProperty

InitialColorProperty

Identifies the InitialColor dependency property. This field is read-only.

public static readonly DependencyProperty InitialColorProperty

IsColorSwatchRowVisibleProperty

Identifies the IsColorSwatchRowVisible dependency property. This field is read-only.

public static readonly DependencyProperty IsColorSwatchRowVisibleProperty

IsInitialColorVisibleProperty

Identifies the IsInitialColorVisible dependency property. This field is read-only.

public static readonly DependencyProperty IsInitialColorVisibleProperty

RProperty

Identifies the R dependency property. This field is read-only.

public static readonly DependencyProperty RProperty

SelectedColorBrushProperty

Identifies the read-only SelectedColorBrush dependency property. This field is read-only.

public static readonly DependencyProperty SelectedColorBrushProperty

SelectedColorChangedEvent

Identifies the SelectedColorChanged routed event. This field is read-only.

public static readonly RoutedEvent SelectedColorChangedEvent

SelectedColorProperty

Identifies the SelectedColor dependency property. This field is read-only.

public static readonly DependencyProperty SelectedColorProperty