Class ColorPicker
Represents a control that helps to pick and edit colors.
Inheritance
Implements
Namespace: Syncfusion.Windows.Shared
Assembly: Syncfusion.Shared.Wpf.dll
Syntax
[SkinType(SkinVisualStyle = Skin.Office2003, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/Office2003Style.xaml")]
[SkinType(SkinVisualStyle = Skin.Blend, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/BlendStyle.xaml")]
[SkinType(SkinVisualStyle = Skin.SyncOrange, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/SyncOrange.xaml")]
[SkinType(SkinVisualStyle = Skin.Office2007Blue, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/Office2007BlueStyle.xaml")]
[SkinType(SkinVisualStyle = Skin.Office2007Black, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/Office2007BlackStyle.xaml")]
[SkinType(SkinVisualStyle = Skin.Office2007Silver, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/Office2007SilverStyle.xaml")]
[SkinType(SkinVisualStyle = Skin.Office2010Blue, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/Office2010BlueStyle.xaml")]
[SkinType(SkinVisualStyle = Skin.Office2010Black, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/Office2010BlackStyle.xaml")]
[SkinType(SkinVisualStyle = Skin.Office2010Silver, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/Office2010SilverStyle.xaml")]
[SkinType(SkinVisualStyle = Skin.VS2010, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/VS2010Style.xaml")]
[SkinType(SkinVisualStyle = Skin.ShinyRed, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/ShinyRed.xaml")]
[SkinType(SkinVisualStyle = Skin.ShinyBlue, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/ShinyBlue.xaml")]
[SkinType(SkinVisualStyle = Skin.Default, Type = typeof(ColorPicker), XamlResource = "/Syncfusion.Shared.Wpf;component/Controls/ColorPicker/Themes/generic.xaml")]
[SkinType(SkinVisualStyle = Skin.Transparent, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/TransparentStyle.xaml")]
[SkinType(SkinVisualStyle = Skin.Metro, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/MetroStyle.xaml")]
[SkinType(SkinVisualStyle = Skin.Office2013, Type = typeof(ColorPicker), XamlResource = "pack://application:,,,/Syncfusion.Shared.Wpf.Classic;component/Controls/ColorPicker/Themes/Office2013Style.xaml")]
public class ColorPicker : Control, IDisposable
Examples
This example shows how to create a ColorPicker in XAML.
<Window x:Class="ColorPicker.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:Syncfusion.Windows.Tools.Controls;assembly=Syncfusion.Tools.WPF" Title="ColorPicker" Height="300" Width="300">
<StackPanel HorizontalAlignment="Center">
<s:ColorPicker Name="myColorPicker" Width="200" BorderThickness="1" HorizontalAlignment="Left"></s:ColorPicker>
</StackPanel>
</Window>
This example shows how to create a ColorPicker in C#.
using System.Windows;
using System.Windows.Controls;
using Syncfusion.Windows.Tools.Controls;
namespace Sample1
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
ColorPicker myColorPicker = new ColorPicker();
stackPanel.Children.Add( myColorPicker );
}
}
}
Constructors
ColorPicker()
Initializes a new instance of the ColorPicker class.
Declaration
public ColorPicker()
Fields
BrushModeProperty
Dependency property which has brush mode
Declaration
public static readonly DependencyProperty BrushModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
BrushProperty
Dependency property which has brush
Declaration
public static readonly DependencyProperty BrushProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
ColorEditBackgroundProperty
Identifies ColorPicker.ColorEditBackground dependency property.
Declaration
public static readonly DependencyProperty ColorEditBackgroundProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | Type: Brush |
EnableSolidToGradientSwitchProperty
Dependency property which has enable solid to gradient switch
Declaration
public static readonly DependencyProperty EnableSolidToGradientSwitchProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
EnableToolTipProperty
Identifies ColorPicker. EnableToolTip dependency property.
Declaration
public static readonly DependencyProperty EnableToolTipProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
GradientBrushDisplayModeProperty
Identifies the GradientBrushDisplayModeProperty
Declaration
public static readonly DependencyProperty GradientBrushDisplayModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
GradientPropertyEditorModeProperty
Dependency property which has gradient property editormodel
Declaration
public static readonly DependencyProperty GradientPropertyEditorModeProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
HeaderTemplateProperty
Identifies the HeaderTemplate dependency property.
Declaration
public static readonly DependencyProperty HeaderTemplateProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
IsAlphaVisibleProperty
Identifies ColorPicker. IsAlphaVisible dependency property.
Declaration
public static readonly DependencyProperty IsAlphaVisibleProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | Type: System.Boolean |
IsCenterVisibleProperty
Identifies ColorPicker.IsCenterVisible dependency property.
Declaration
public static readonly DependencyProperty IsCenterVisibleProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | Type: System.Boolean |
IsGradientOriginVisibleProperty
Identifies ColorPicker.IsGradientOriginVisible dependency property.
Declaration
public static readonly DependencyProperty IsGradientOriginVisibleProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | Type: System.Boolean |
IsGradientPropertyEnabledProperty
Dependency property which has is gradient property enabled
Declaration
public static readonly DependencyProperty IsGradientPropertyEnabledProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
IsOpenGradientPropertyEditorProperty
Dependency property which has is open gradient property editor
Declaration
public static readonly DependencyProperty IsOpenGradientPropertyEditorProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
IsRadiusVisibleProperty
Identifies ColorPicker.IsRadiusVisible dependency property.
Declaration
public static readonly DependencyProperty IsRadiusVisibleProperty
Field Value
Type | Description |
---|---|
System.Windows.DependencyProperty | Type: System.Boolean |
M_displayPopup
Command for open popup.
Declaration
public static RoutedCommand M_displayPopup
Field Value
Type |
---|
System.Windows.Input.RoutedCommand |
VisualizationStyleProperty
Dependency property which has visualization
Declaration
public static readonly DependencyProperty VisualizationStyleProperty
Field Value
Type |
---|
System.Windows.DependencyProperty |
Properties
Brush
Gets or sets a value which comprises selected brush.
Declaration
public Brush Brush { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Brush | The brush. |
BrushMode
Gets or sets a value determines the mode of selected brush.
Declaration
public BrushModes BrushMode { get; set; }
Property Value
Type | Description |
---|---|
BrushModes | The brush mode. |
Color
Gets or sets the selected color of ColorPicker control.
Declaration
public Color Color { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Color | Type: Color |
ColorEditBackground
Gets or sets a brush that describes the popup background of ColorPicker control.
Declaration
public Brush ColorEditBackground { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.Media.Brush | Type: Brush |
EnableSolidToGradientSwitch
Gets or sets a value indicating whether to enable solid to gradient switch.
Declaration
public bool EnableSolidToGradientSwitch { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
EnableToolTip
Gets or sets a value indicating whether to show tooltip or not.
Declaration
public bool EnableToolTip { get; set; }
Property Value
Type |
---|
System.Boolean |
GradientBrushDisplayMode
Gets or sets a value detemines the mode to display the gradient property.
Declaration
public GradientBrushDisplayMode GradientBrushDisplayMode { get; set; }
Property Value
Type | Description |
---|---|
GradientBrushDisplayMode | The gradient property display mode. |
GradientPropertyEditorMode
Gets or sets a value detemines the mode of the gradient property editor.
Declaration
public GradientPropertyEditorMode GradientPropertyEditorMode { get; set; }
Property Value
Type | Description |
---|---|
GradientPropertyEditorMode | The gradient property editor mode. |
HeaderTemplate
Gets or sets the data template used to display the content of the ColorPicker header.
Declaration
public DataTemplate HeaderTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Windows.DataTemplate | Type: System.Windows.DataTemplate |
See Also
IsAlphaVisible
Gets or sets a value indicating whether the Alpha editor is visible or not.
Declaration
public bool IsAlphaVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Type: System.Boolean |
IsCenterVisible
Gets or sets a value indicating whether the input box for the center of a radial gradient color is visible.
Declaration
public bool IsCenterVisible { get; set; }
Property Value
Type |
---|
System.Boolean |
IsColorPaletteVisible
Gets or sets a value indicating whether the ColorPalette is visible or not.
Declaration
public bool IsColorPaletteVisible { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Type: System.Boolean |
IsGradientOriginVisible
Gets or sets a value indicating whether the input box for the gradient origin of a radial gradient color is visible.
Declaration
public bool IsGradientOriginVisible { get; set; }
Property Value
Type |
---|
System.Boolean |
IsGradientPropertyEnabled
Gets or sets a value indicating whether to enable gradient property or not.
Declaration
public bool IsGradientPropertyEnabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsOpenGradientPropertyEditor
Gets or sets a value indicating whether to open gradient property editor or not.
Declaration
public bool IsOpenGradientPropertyEditor { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsRadiusVisible
Gets or sets a value indicating whether the input box for the radius of a radial gradient color is visible.
Declaration
public bool IsRadiusVisible { get; set; }
Property Value
Type |
---|
System.Boolean |
VisualizationStyle
Gets or sets a value detemines the selection mode of the ColorPicker. property.
Declaration
public ColorSelectionMode VisualizationStyle { get; set; }
Property Value
Type | Description |
---|---|
ColorSelectionMode | Type: ColorSelectionMode |
Methods
ColorChange(DependencyObject, DependencyPropertyChangedEventArgs)
Changes the color.
Declaration
public void ColorChange(DependencyObject sender, DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyObject | sender | Dependency object. |
System.Windows.DependencyPropertyChangedEventArgs | e | The System.Windows.DependencyPropertyChangedEventArgs instance containing the event data. |
Dispose()
Disposes all the resources.
Declaration
public void Dispose()
OnApplyTemplate()
When implemented in a derived class, will be invoked whenever application code or internal processes call System.Windows.FrameworkElement.ApplyTemplate.
Declaration
public override void OnApplyTemplate()
OnIsGradientPropertyEnabledChanged(DependencyPropertyChangedEventArgs)
Raises the IsGradientPropertyEnabledChanged event.
Declaration
protected virtual void OnIsGradientPropertyEnabledChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | The System.Windows.DependencyPropertyChangedEventArgs instance containing the event data. |
OnMouseWheel(MouseWheelEventArgs)
Handles mouse wheel event for ColorPicker
Declaration
protected override void OnMouseWheel(MouseWheelEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.MouseWheelEventArgs | e |
OnPreviewKeyDown(KeyEventArgs)
Declaration
protected override void OnPreviewKeyDown(KeyEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Input.KeyEventArgs | e |
OnPropertyChanged(DependencyPropertyChangedEventArgs)
Invoked whenever the effective value of any dependency property on this System.Windows.FrameworkElement has been updated. The specific dependency property that changed is reported in the arguments parameter. Overrides System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs).
Declaration
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.DependencyPropertyChangedEventArgs | e | The event data that describes the property that changed, as well as old and new values. |
Events
ColorChanged
Occurs when the Color property changed in ColorPicker.
Declaration
public event PropertyChangedCallback ColorChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
EnableToolTipChanged
Occurs when the EnableToolTip property changed in ColorPicker.
Declaration
public event PropertyChangedCallback EnableToolTipChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
GradientBrushDisplayModeChanged
Occurs when the GradientBrushDisplayMode property changed in ColorPicker.
Declaration
public event PropertyChangedCallback GradientBrushDisplayModeChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
GradientPropertyEditorModeChanged
Occurs when the GradientPropertyEditorMode property changed in ColorPicker.
Declaration
public event PropertyChangedCallback GradientPropertyEditorModeChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
IsGradientPropertyEnabledChanged
Occurs when the IsGradientPropertyEnabled property changed in ColorPicker.
Declaration
public event PropertyChangedCallback IsGradientPropertyEnabledChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
IsOpenGradientPropertyEditorChanged
Occurs when the IsOpenGradientPropertyEditor property changed in ColorPicker.
Declaration
public event PropertyChangedCallback IsOpenGradientPropertyEditorChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
SelectedBrushChanged
Occurs when the Brush property changed in ColorPicker.
Declaration
public event PropertyChangedCallback SelectedBrushChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
SelectedBrushModeChanged
Occurs when the BrushMode property changed in ColorPicker.
Declaration
public event PropertyChangedCallback SelectedBrushModeChanged
Event Type
Type |
---|
System.Windows.PropertyChangedCallback |
SelectedColorChanged
Occurs when the selected color changes.
Declaration
public event EventHandler<SelectedColorChangedEventArgs> SelectedColorChanged
Event Type
Type |
---|
System.EventHandler<SelectedColorChangedEventArgs> |
Remarks
This event is raised when the Color property of the control changes, indicating a change in the selected color.