Table of Contents

Class ColorPicker

Namespace
Icy.UI.Controls
Assembly
IcyUI.dll

A full color picker - swatches, an HSV square + hue strip, and RGBA sliders + a hex field, switchable via an internal TabControl.

public class ColorPicker : Control, INotifyPropertyChanging, IBindingTarget, INotifyPropertyChanged, INotifyFocusChanged, IContainerLayout
Inheritance
ColorPicker
Implements
Inherited Members
Extension Methods

Remarks

All sub-widgets stay synchronized to the single SelectedColor behind a re-entrancy guard - each sub-widget's own change handler checks the guard before writing back to SelectedColor, so SelectedColor's own setter pushing the new value out to every sub-widget doesn't bounce back through them and loop.

Not currently template-safe (see Template's own remarks) - the internal TabControl is composed directly into Chrome once, at construction, with no OnApplyTemplate() override to re-wire it, the same limitation ScrollViewer/TextBox currently have. Setting Template on a ColorPicker silently orphans this whole visual tree instead of throwing.

Constructors

ColorPicker()

Initializes a new instance of the ColorPicker class.

public ColorPicker()

Properties

SelectedColor

Gets or sets the currently picked color.

[BindingOverride(BindingMode.TwoWay)]
public Color SelectedColor { get; set; }

Property Value

Color

SwatchColors

Gets the palette shown in the "Swatches" tab. Call RefreshSwatches() after mutating this collection - it isn't itself change-notifying.

public IList<Color> SwatchColors { get; }

Property Value

IList<Color>

Remarks

Starts with eight common colors (white, black, red, orange, gold, green, blue and purple), so the tab isn't empty; clear it and add your game's own palette.

Methods

RefreshSwatches()

Rebuilds the "Swatches" tab's buttons from the current SwatchColors.

public void RefreshSwatches()

Events

ColorChanged

Occurs when SelectedColor changes.

public event EventHandler? ColorChanged

Event Type

EventHandler