Implementing Syncfusion WinUI Color Picker (SfColorPicker)
When to Use This Skill
Use this skill immediately when the user:
- Needs to implement a color picker UI in a WinUI application
- Wants to select solid colors with multiple color models (RGB, HSV, HSL, CMYK)
- Requires gradient brush creation (linear or radial)
- Needs to customize the color spectrum shape (box or ring)
- Wants to provide color editing with alpha/opacity control
- Needs to switch between solid and gradient brush modes
- Requires hexadecimal color input/output
- Wants to handle color selection change events
- Needs to customize color channel input options (sliders, text inputs)
- Requires programmatic color brush selection
This skill is specifically for the Syncfusion WinUI Color Picker (SfColorPicker) control, not generic color picking solutions.
Component Overview
The SfColorPicker is a WinUI control for selecting and adjusting color values. It supports:
- Solid Colors: RGB, HSV, HSL, CMYK color models with hexadecimal editor
- Gradient Brushes: Linear and radial gradient color brushes with multiple stops
- Color Spectrum: Interactive color selection with box or ring shape
- Opacity Control: Alpha channel adjustment via sliders and text inputs
- Mode Switching: Dynamic switching between solid and gradient modes
- Event Notifications: Real-time color selection change events
Key Namespace:
using Syncfusion.UI.Xaml.Editors;
NuGet Package:
Syncfusion.Editors.WinUI
Documentation and Navigation Guide
Getting Started with SfColorPicker
📄 Read: references/getting-started.md
Read this reference when you need:
- Installation and NuGet package setup instructions
- Basic
SfColorPicker control implementation
- Namespace and assembly references
- First working XAML + C# example with event handling
- Understanding the control structure and troubleshooting setup issues
Topics covered:
- Creating a WinUI 3 desktop application
- Adding
Syncfusion.Editors.WinUI NuGet package
- Importing the control namespace
- Basic XAML and C# initialization
- Control structure overview
- Common initial configurations
Solid Color Selection
📄 Read: references/solid-color-selection.md
Read this reference when you need:
- Selecting solid color brushes programmatically or interactively
- Working with different color models (RGB, HSV, HSL, CMYK)
- Switching between color channels at runtime
- Implementing hexadecimal color input/output
- Controlling opacity/alpha values
- Customizing color channel input options (sliders vs text)
- Handling solid color selection change events
Topics covered:
SelectedBrush property for programmatic and interactive selection
ColorChannelOptions (RGB, HSV, HSL, CMYK) with usage examples
BrushTypeOptions to restrict solid-only mode
AlphaInputOptions for opacity control (All, TextInput, SliderInput)
IsHexInputVisible for hexadecimal editor visibility
ColorChannelInputOptions (TextInput, SliderInput, All)
ColorEditorsVisibilityMode (Inline, Expandable, Collapsed)
SelectedBrushChanged event handling
Gradient Color Selection
📄 Read: references/gradient-color-selection.md
Read this reference when you need:
- Creating linear gradient brushes with multiple color stops
- Creating radial gradient brushes with gradient origin and center
- Programmatic gradient brush configuration
- Interactive gradient editing at runtime
- Adjusting gradient angles and directions
- Modifying gradient offsets (start/end points, radius)
- Controlling gradient opacity
- Handling gradient color change events
Topics covered:
LinearGradientBrush with GradientStop, StartPoint, EndPoint
RadialGradientBrush with GradientOrigin, Center, RadiusX, RadiusY
- Interactive gradient creation with
BrushTypeOptions
AxisInputOption — Simple (angle/direction) vs Advanced (precise editors)
- Adding, removing, and reordering gradient stops
- Gradient opacity control
SelectedBrushChanged event for gradient brushes
UI Customization and Modes
📄 Read: references/ui-customization.md
Read this reference when you need:
- Switching between solid, linear, and radial brush modes
- Enabling or restricting specific brush types
- Changing color spectrum shapes (box vs ring)
- Customizing color spectrum components (hue, saturation, value)
- Understanding
BrushTypeOptions combinations
- Runtime brush mode switching behavior
Topics covered:
BrushTypeOptions configurations (SolidColorBrush, LinearGradientBrush, RadialGradientBrush, All)
- Interactive brush mode dropdown behavior
ColorSpectrumShape (Box vs Ring) with when-to-use guidance
ColorSpectrumComponents (SaturationValue, HueSaturation, HueValue, etc.)
- Common customization patterns for different app types
Best Practices and Troubleshooting
📄 Read: references/best-practices.md
Read this reference when you need:
- Guidance on when to use solid vs gradient colors
- Performance optimization tips for gradients
- Common use case implementation patterns
- Troubleshooting color selection or rendering issues
- Accessibility considerations
- Integration patterns (flyout, dialog, property panel)
Topics covered:
- Solid vs gradient decision matrix
- Performance tips: gradient stop limits, caching brushes, debouncing events
- Common use cases: theme picker, drawing tool, text highlighter, background editor
- Flyout, dialog, and property panel integration patterns
- Common mistakes (brush type mismatch, missing null checks)
- Accessibility: keyboard navigation, ARIA attributes, screen reader support
Quick Start Example
XAML
<Page
x:Class="ColorPickerApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:editors="using:Syncfusion.UI.Xaml.Editors">
<Grid>
<editors:SfColorPicker
x:Name="colorPicker"
SelectedBrush="Blue"
BrushTypeOptions="All"
SelectedBrushChanged="ColorPicker_SelectedBrushChanged" />
</Grid>
</Page>
C# Code-Behind
using Syncfusion.UI.Xaml.Editors;
using Microsoft.UI.Xaml.Media;
private void ColorPicker_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs args)
{
if (args?.NewBrush is SolidColorBrush solidBrush)
{
var color = solidBrush.Color; // Access R, G, B, A
}
else if (args?.NewBrush is LinearGradientBrush linearBrush)
{
var stops = linearBrush.GradientStops;
}
else if (args?.NewBrush is RadialGradientBrush radialBrush)
{
var stops = radialBrush.GradientStops;
}
}
Common Patterns
Pattern 1: Solid Color Picker Only
<editors:SfColorPicker
BrushTypeOptions="SolidColorBrush"
ColorChannelOptions="RGB"
IsHexInputVisible="True" />
Pattern 2: Gradient Editor Only
<editors:SfColorPicker
BrushTypeOptions="LinearGradientBrush,RadialGradientBrush"
AxisInputOption="Simple" />
Pattern 3: Programmatic Color Selection
// Solid color
colorPicker.SelectedBrush = new SolidColorBrush(Colors.Red);
// Linear gradient
var linearGradient = new LinearGradientBrush();
linearGradient.StartPoint = new Point(0, 0);
linearGradient.EndPoint = new Point(1, 1);
linearGradient.GradientStops.Add(new GradientStop() { Color = Colors.Yellow, Offset = 0.0 });
linearGradient.GradientStops.Add(new GradientStop() { Color = Colors.Red, Offset = 1.0 });
colorPicker.SelectedBrush = linearGradient;
Pattern 4: Custom Spectrum Shape
<editors:SfColorPicker
ColorSpectrumShape="Ring"
ColorSpectrumComponents="HueSaturation" />
Key Properties Reference
| Property |
Type |
Default |
Purpose |
SelectedBrush |
Brush |
Blue |
Gets/sets the selected color brush |
BrushTypeOptions |
BrushTypeOptions |
All |
Enables specific brush modes (Solid, Linear, Radial) |
ColorChannelOptions |
ColorChannelOptions |
RGB |
Sets color model (RGB, HSV, HSL, CMYK) |
ColorSpectrumShape |
ColorSpectrumShape |
Box |
Sets spectrum shape (Box or Ring) |
ColorSpectrumComponents |
ColorSpectrumComponents |
SaturationValue |
Defines spectrum axes |
AlphaInputOptions |
ColorInputOptions |
All |
Controls alpha/opacity input visibility |
IsHexInputVisible |
bool |
true |
Shows/hides hexadecimal editor |
ColorChannelInputOptions |
ColorInputOptions |
All |
Controls channel input type (Slider/Text/All) |
ColorEditorsVisibilityMode |
ColorEditorsVisibilityMode |
Inline |
Sets editor visibility (Inline/Expandable/Collapsed) |
AxisInputOption |
AxisInputOption |
Simple |
Controls gradient axis input complexity |
Key Events
| Event |
Args |
Purpose |
SelectedBrushChanged |
SelectedBrushChangedEventArgs |
Fired when selected brush changes |
Event Args: OldBrush (previous selection) · NewBrush (new selection)
Common Use Cases
- Theme Color Selector — Let users customize app theme colors
- Drawing Tool — Color selection for graphic/drawing applications
- Style Editor — UI element color customization in design tools
- Gradient Background Editor — Create gradient backgrounds or visual effects
- Color Palette Manager — Manage color palettes in creative applications
1---2name: syncfusion-winui-color-picker3description: Guide implementation of the Syncfusion SfColorPicker control in WinUI applications. Use this skill when implementing color picker UI, solid color selection with RGB/HSV/HSL/CMYK models, or gradient brushes (linear and radial). Covers color spectrum customization, opacity control, brush mode switching, and color value management in WinUI/WinUI 3 projects.4---56# Implementing Syncfusion WinUI Color Picker (SfColorPicker)78## When to Use This Skill910Use this skill **immediately** when the user:1112- Needs to implement a color picker UI in a WinUI application13- Wants to select solid colors with multiple color models (RGB, HSV, HSL, CMYK)14- Requires gradient brush creation (linear or radial)15- Needs to customize the color spectrum shape (box or ring)16- Wants to provide color editing with alpha/opacity control17- Needs to switch between solid and gradient brush modes18- Requires hexadecimal color input/output19- Wants to handle color selection change events20- Needs to customize color channel input options (sliders, text inputs)21- Requires programmatic color brush selection2223This skill is specifically for the **Syncfusion WinUI Color Picker** (`SfColorPicker`) control, not generic color picking solutions.2425## Component Overview2627The **SfColorPicker** is a WinUI control for selecting and adjusting color values. It supports:2829- **Solid Colors**: RGB, HSV, HSL, CMYK color models with hexadecimal editor30- **Gradient Brushes**: Linear and radial gradient color brushes with multiple stops31- **Color Spectrum**: Interactive color selection with box or ring shape32- **Opacity Control**: Alpha channel adjustment via sliders and text inputs33- **Mode Switching**: Dynamic switching between solid and gradient modes34- **Event Notifications**: Real-time color selection change events3536**Key Namespace:**37```csharp38using Syncfusion.UI.Xaml.Editors;39```4041**NuGet Package:**42```43Syncfusion.Editors.WinUI44```4546---4748## Documentation and Navigation Guide4950### Getting Started with SfColorPicker5152📄 **Read:** [references/getting-started.md](references/getting-started.md)5354**Read this reference when you need:**55- Installation and NuGet package setup instructions56- Basic `SfColorPicker` control implementation57- Namespace and assembly references58- First working XAML + C# example with event handling59- Understanding the control structure and troubleshooting setup issues6061**Topics covered:**62- Creating a WinUI 3 desktop application63- Adding `Syncfusion.Editors.WinUI` NuGet package64- Importing the control namespace65- Basic XAML and C# initialization66- Control structure overview67- Common initial configurations6869---7071### Solid Color Selection7273📄 **Read:** [references/solid-color-selection.md](references/solid-color-selection.md)7475**Read this reference when you need:**76- Selecting solid color brushes programmatically or interactively77- Working with different color models (RGB, HSV, HSL, CMYK)78- Switching between color channels at runtime79- Implementing hexadecimal color input/output80- Controlling opacity/alpha values81- Customizing color channel input options (sliders vs text)82- Handling solid color selection change events8384**Topics covered:**85- `SelectedBrush` property for programmatic and interactive selection86- `ColorChannelOptions` (RGB, HSV, HSL, CMYK) with usage examples87- `BrushTypeOptions` to restrict solid-only mode88- `AlphaInputOptions` for opacity control (All, TextInput, SliderInput)89- `IsHexInputVisible` for hexadecimal editor visibility90- `ColorChannelInputOptions` (TextInput, SliderInput, All)91- `ColorEditorsVisibilityMode` (Inline, Expandable, Collapsed)92- `SelectedBrushChanged` event handling9394---9596### Gradient Color Selection9798📄 **Read:** [references/gradient-color-selection.md](references/gradient-color-selection.md)99100**Read this reference when you need:**101- Creating linear gradient brushes with multiple color stops102- Creating radial gradient brushes with gradient origin and center103- Programmatic gradient brush configuration104- Interactive gradient editing at runtime105- Adjusting gradient angles and directions106- Modifying gradient offsets (start/end points, radius)107- Controlling gradient opacity108- Handling gradient color change events109110**Topics covered:**111- `LinearGradientBrush` with `GradientStop`, `StartPoint`, `EndPoint`112- `RadialGradientBrush` with `GradientOrigin`, `Center`, `RadiusX`, `RadiusY`113- Interactive gradient creation with `BrushTypeOptions`114- `AxisInputOption` — Simple (angle/direction) vs Advanced (precise editors)115- Adding, removing, and reordering gradient stops116- Gradient opacity control117- `SelectedBrushChanged` event for gradient brushes118119---120121### UI Customization and Modes122123📄 **Read:** [references/ui-customization.md](references/ui-customization.md)124125**Read this reference when you need:**126- Switching between solid, linear, and radial brush modes127- Enabling or restricting specific brush types128- Changing color spectrum shapes (box vs ring)129- Customizing color spectrum components (hue, saturation, value)130- Understanding `BrushTypeOptions` combinations131- Runtime brush mode switching behavior132133**Topics covered:**134- `BrushTypeOptions` configurations (SolidColorBrush, LinearGradientBrush, RadialGradientBrush, All)135- Interactive brush mode dropdown behavior136- `ColorSpectrumShape` (Box vs Ring) with when-to-use guidance137- `ColorSpectrumComponents` (SaturationValue, HueSaturation, HueValue, etc.)138- Common customization patterns for different app types139140---141142### Best Practices and Troubleshooting143144📄 **Read:** [references/best-practices.md](references/best-practices.md)145146**Read this reference when you need:**147- Guidance on when to use solid vs gradient colors148- Performance optimization tips for gradients149- Common use case implementation patterns150- Troubleshooting color selection or rendering issues151- Accessibility considerations152- Integration patterns (flyout, dialog, property panel)153154**Topics covered:**155- Solid vs gradient decision matrix156- Performance tips: gradient stop limits, caching brushes, debouncing events157- Common use cases: theme picker, drawing tool, text highlighter, background editor158- Flyout, dialog, and property panel integration patterns159- Common mistakes (brush type mismatch, missing null checks)160- Accessibility: keyboard navigation, ARIA attributes, screen reader support161162---163164## Quick Start Example165166### XAML167```xml168<Page169 x:Class="ColorPickerApp.MainPage"170 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"171 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"172 xmlns:editors="using:Syncfusion.UI.Xaml.Editors">173174 <Grid>175 <editors:SfColorPicker176 x:Name="colorPicker"177 SelectedBrush="Blue"178 BrushTypeOptions="All"179 SelectedBrushChanged="ColorPicker_SelectedBrushChanged" />180 </Grid>181</Page>182```183184### C# Code-Behind185```csharp186using Syncfusion.UI.Xaml.Editors;187using Microsoft.UI.Xaml.Media;188189private void ColorPicker_SelectedBrushChanged(object sender, SelectedBrushChangedEventArgs args)190{191 if (args?.NewBrush is SolidColorBrush solidBrush)192 {193 var color = solidBrush.Color; // Access R, G, B, A194 }195 else if (args?.NewBrush is LinearGradientBrush linearBrush)196 {197 var stops = linearBrush.GradientStops;198 }199 else if (args?.NewBrush is RadialGradientBrush radialBrush)200 {201 var stops = radialBrush.GradientStops;202 }203}204```205206---207208## Common Patterns209210### Pattern 1: Solid Color Picker Only211```xml212<editors:SfColorPicker213 BrushTypeOptions="SolidColorBrush"214 ColorChannelOptions="RGB"215 IsHexInputVisible="True" />216```217218### Pattern 2: Gradient Editor Only219```xml220<editors:SfColorPicker221 BrushTypeOptions="LinearGradientBrush,RadialGradientBrush"222 AxisInputOption="Simple" />223```224225### Pattern 3: Programmatic Color Selection226```csharp227// Solid color228colorPicker.SelectedBrush = new SolidColorBrush(Colors.Red);229230// Linear gradient231var linearGradient = new LinearGradientBrush();232linearGradient.StartPoint = new Point(0, 0);233linearGradient.EndPoint = new Point(1, 1);234linearGradient.GradientStops.Add(new GradientStop() { Color = Colors.Yellow, Offset = 0.0 });235linearGradient.GradientStops.Add(new GradientStop() { Color = Colors.Red, Offset = 1.0 });236colorPicker.SelectedBrush = linearGradient;237```238239### Pattern 4: Custom Spectrum Shape240```xml241<editors:SfColorPicker242 ColorSpectrumShape="Ring"243 ColorSpectrumComponents="HueSaturation" />244```245246---247248## Key Properties Reference249250| Property | Type | Default | Purpose |251|----------|------|---------|---------|252| `SelectedBrush` | Brush | Blue | Gets/sets the selected color brush |253| `BrushTypeOptions` | BrushTypeOptions | All | Enables specific brush modes (Solid, Linear, Radial) |254| `ColorChannelOptions` | ColorChannelOptions | RGB | Sets color model (RGB, HSV, HSL, CMYK) |255| `ColorSpectrumShape` | ColorSpectrumShape | Box | Sets spectrum shape (Box or Ring) |256| `ColorSpectrumComponents` | ColorSpectrumComponents | SaturationValue | Defines spectrum axes |257| `AlphaInputOptions` | ColorInputOptions | All | Controls alpha/opacity input visibility |258| `IsHexInputVisible` | bool | true | Shows/hides hexadecimal editor |259| `ColorChannelInputOptions` | ColorInputOptions | All | Controls channel input type (Slider/Text/All) |260| `ColorEditorsVisibilityMode` | ColorEditorsVisibilityMode | Inline | Sets editor visibility (Inline/Expandable/Collapsed) |261| `AxisInputOption` | AxisInputOption | Simple | Controls gradient axis input complexity |262263## Key Events264265| Event | Args | Purpose |266|-------|------|---------|267| `SelectedBrushChanged` | SelectedBrushChangedEventArgs | Fired when selected brush changes |268269**Event Args:** `OldBrush` (previous selection) · `NewBrush` (new selection)270271---272273## Common Use Cases2742751. **Theme Color Selector** — Let users customize app theme colors2762. **Drawing Tool** — Color selection for graphic/drawing applications2773. **Style Editor** — UI element color customization in design tools2784. **Gradient Background Editor** — Create gradient backgrounds or visual effects2795. **Color Palette Manager** — Manage color palettes in creative applications