Class ColorSwatch
- Namespace
- PluginUI
- Assembly
- PluginUI.dll
Color well: shows a color (checkerboard behind translucent colors); clicking opens a ColorPickerPopup and updates the color live.
public class ColorSwatch : Control
- Inheritance
-
ColorSwatch
- Inherited Members
Constructors
ColorSwatch()
Creates a swatch.
public ColorSwatch()
ColorSwatch(Color)
Creates a swatch showing color.
public ColorSwatch(Color color)
Parameters
colorColor
Properties
AllowAlpha
Lets the picker edit the alpha channel.
public bool AllowAlpha { get; set; }
Property Value
Color
Color.
public Color Color { get; set; }
Property Value
DefaultSize
Natural size used when no explicit size is given.
protected override Size DefaultSize { get; }
Property Value
IsEditable
Opens the picker on click (otherwise the swatch is display-only).
public bool IsEditable { get; set; }
Property Value
ValueText
Text drawn in the value area (null = no value area).
public override string? ValueText { get; }
Property Value
Methods
OnDetached()
Called when the element leaves its host (unsubscribe here).
protected override void OnDetached()
OnKeyDown(KeyEventArgs)
Key pressed while focused (bubbles to parents).
protected override void OnKeyDown(KeyEventArgs e)
Parameters
OnMouseDown(MouseEventArgs)
Mouse button pressed over the element (or captured).
protected override void OnMouseDown(MouseEventArgs e)
Parameters
OpenPicker()
Opens the color picker popup below the swatch.
public void OpenPicker()
RenderVector(DrawingContext, Rect, VectorStyle)
Vector rendering of the widget area.
protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)
Parameters
dcDrawingContextwidgetRectstyleVectorStyle
Events
ColorChanged
Raised when the color changes (live while picking).
public event Action<ColorSwatch, Color>? ColorChanged
Event Type
ColorCommitted
Raised when a picking session ends with a new color.
public event Action<ColorSwatch, Color>? ColorCommitted