Class SfColorPicker
Represents a control that lets a user pick a Microsoft.UI.Xaml.Media.SolidColorBrush, Microsoft.UI.Xaml.Media.LinearGradientBrush or Microsoft.UI.Xaml.Media.RadialGradientBrush.
Inheritance
Implements
Namespace: Syncfusion.UI.Xaml.Editors
Assembly: Syncfusion.Editors.WinUI.dll
Syntax
public class SfColorPicker : Control, IDisposable
Examples
<syncfusion:SfColorPicker
BrushTypeOptions="SolidColorBrush"
ColorChannelInputOptions="All"
ColorChannelOptions="All"
ColorEditorsVisibilityMode="Inline"
IsHexInputVisible="True">
<syncfusion:SfColorPicker.SelectedBrush>
<SolidColorBrush Color="Green"/>
</syncfusion:SfColorPicker.SelectedBrush>
</syncfusion:SfColorPicker>
Constructors
SfColorPicker()
Initializes a new instance of the SfColorPicker class.
Declaration
public SfColorPicker()
Fields
AlphaInputOptionsProperty
Identifies AlphaInputOptions dependency property.
Declaration
public static readonly DependencyProperty AlphaInputOptionsProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
AxisInputOptionProperty
Identifies AxisInputOption dependency property.
Declaration
public static readonly DependencyProperty AxisInputOptionProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
BrushTypeOptionsProperty
Identifies BrushTypeOptions dependency property.
Declaration
public static readonly DependencyProperty BrushTypeOptionsProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
ColorChannelInputOptionsProperty
Identifies ColorChannelInputOptions dependency property.
Declaration
public static readonly DependencyProperty ColorChannelInputOptionsProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
ColorChannelOptionsProperty
Identifies ColorChannelOptions dependency property.
Declaration
public static readonly DependencyProperty ColorChannelOptionsProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
ColorEditorsVisibilityModeProperty
Identifies ColorEditorsVisibilityMode dependency property.
Declaration
public static readonly DependencyProperty ColorEditorsVisibilityModeProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
ColorInfoProperty
Identifies ColorInfo dependency property.
Declaration
public static readonly DependencyProperty ColorInfoProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
ColorSpectrumComponentsProperty
Identifies ColorSpectrumComponents dependency property.
Declaration
public static readonly DependencyProperty ColorSpectrumComponentsProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
ColorSpectrumShapeProperty
Identifies ColorSpectrumShape dependency property.
Declaration
public static readonly DependencyProperty ColorSpectrumShapeProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
IsHexInputVisibleProperty
Identifies IsHexInputVisible dependency property.
Declaration
public static readonly DependencyProperty IsHexInputVisibleProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
SelectedBrushProperty
Identifies SelectedBrush dependency property.
Declaration
public static readonly DependencyProperty SelectedBrushProperty
Field Value
Type |
---|
Microsoft.UI.Xaml.DependencyProperty |
Properties
AlphaInputOptions
Gets or sets a value that indicates whether the alpha channel can be edited using TextInput, Slider or both.
Declaration
public ColorInputOptions AlphaInputOptions { get; set; }
Property Value
Type | Description |
---|---|
ColorInputOptions | A value of enumeration. The default value is All. |
Examples
<syncfusion:SfColorPicker
ColorChannelOptions="SliderInput, TextInput"/>
AxisInputOption
Gets or sets a value that indicates whether to edit gradient direction using simple or advanced editor.
Declaration
public AxisInputOption AxisInputOption { get; set; }
Property Value
Type | Description |
---|---|
AxisInputOption | A value of enumeration. The default value is simple. |
Remarks
Most often used directions are covered in simple editor. In simple editor, StartPoint and EndPoint of LinearGradientBrush is edited using angle between the points. In simple editor, Center, Origin and Radius of RadialGradientBrush is edited by choosing one from available predefined set. Advanced editor is used for more precise and accurate gradient direction.
BrushTypeOptions
Gets or sets one or more supported brush types (Microsoft.UI.Xaml.Media.SolidColorBrush, Microsoft.UI.Xaml.Media.LinearGradientBrush, Microsoft.UI.Xaml.Media.RadialGradientBrush) that can be toggled interactively.
Declaration
public BrushTypeOptions BrushTypeOptions { get; set; }
Property Value
Type | Description |
---|---|
BrushTypeOptions | A value of the enumeration. The default is All. |
Remarks
A ComboBox will be shown when multiple types are set. ComboBox will be hidden, when there is only one option is set.
Examples
<!-- Shows only SolidColorBrush and LinearGradientBrush, does not shows RadialGradientBrush -->
<syncfusion:SfColorPicker
BrushTypeOptions="SolidColorBrush, LinearGradientBrush"/>
ColorChannelInputOptions
Gets or sets a value indicating the type of editor (TextInput, Slider or both) to edit the color value.
Declaration
public ColorInputOptions ColorChannelInputOptions { get; set; }
Property Value
Type | Description |
---|---|
ColorInputOptions | A value of enumeration. The default value in All. |
Remarks
When TextInput is set, value can be edited using a text editor. When Slider is set, value can be edited using a slider. When All is set, value can be edited using a slider and text editor.
Examples
<syncfusion:SfColorPicker
ColorChannelOptions="SliderInput, TextInput"/>
ColorChannelOptions
Gets or sets one or more supported channel options (RGB, HSL, HSV, CMYK) for color editing.
Declaration
public ColorChannelOptions ColorChannelOptions { get; set; }
Property Value
Type | Description |
---|---|
ColorChannelOptions | A value of enumeration. The default is All. |
Remarks
A ComboBox will be shown when multiple types are set. Microsoft.UI.Xaml.Controls.ComboBox will be hidden, when there is only one option is set.
Examples
<syncfusion:SfColorPicker
ColorChannelOptions="HSV, HSL">
</syncfusion:SfColorPicker>
ColorEditorsVisibilityMode
Gets or sets a value to control the visibility of color channel editors.
Declaration
public ColorEditorsVisibilityMode ColorEditorsVisibilityMode { get; set; }
Property Value
Type | Description |
---|---|
ColorEditorsVisibilityMode | A value of enumeration. The default is Inline. |
Remarks
When value is Inline, editor is always visible. When value is Expandable, editor can be collapsed using an Expander. When value is Collapsed, editor will not be visible.
ColorInfo
Gets a wrapper class for SelectedBrush used for color composition.
Declaration
public ColorInfo ColorInfo { get; }
Property Value
Type |
---|
ColorInfo |
ColorSpectrumComponents
Gets or sets a value that indicates how the Hue-Saturation-Value (HSV) color components are mapped onto the ColorSpectrum.
Declaration
public ColorSpectrumComponents ColorSpectrumComponents { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Controls.ColorSpectrumComponents | A value of the enumeration. The default is SaturationValue. |
ColorSpectrumShape
Gets or sets a value that indicates whether the ColorSpectrum is shown as a square or a circle.
Declaration
public ColorSpectrumShape ColorSpectrumShape { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Controls.ColorSpectrumShape | A value of the enumeration. The default is Box, which shows the spectrum as a square. |
IsHexInputVisible
Gets or sets a value indicating whether the text input box for a HEX color value is shown.
Declaration
public bool IsHexInputVisible { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
true if the HEX color text input box is shown; otherwise, false. The default is true.
SelectedBrush
Gets or sets the currently selected brush of SfColorPicker.
Declaration
public Brush SelectedBrush { get; set; }
Property Value
Type | Description |
---|---|
Microsoft.UI.Xaml.Media.Brush | The current brush value. The default is null value. |
Remarks
SelectedBrush can hold Microsoft.UI.Xaml.Media.SolidColorBrush, Microsoft.UI.Xaml.Media.LinearGradientBrush and Microsoft.UI.Xaml.Media.RadialGradientBrush. SelectedBrushChanged event is triggered when SelectedBrush is edited.
Methods
Dispose()
Release the unmanaged resources of SfColorPicker.
Declaration
public void Dispose()
Dispose(Boolean)
Release the unmanaged resources of SfColorPicker.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Used to indicate perform dispose or not. |
OnApplyTemplate()
Declaration
protected override void OnApplyTemplate()
OnCreateAutomationPeer()
Declaration
protected override AutomationPeer OnCreateAutomationPeer()
Returns
Type |
---|
Microsoft.UI.Xaml.Automation.Peers.AutomationPeer |
Events
SelectedBrushChanged
Occurs when selected brush is changed.
Declaration
public event EventHandler<SelectedBrushChangedEventArgs> SelectedBrushChanged
Event Type
Type |
---|
System.EventHandler<SelectedBrushChangedEventArgs> |