Custom WPF controls that allows a user to pick a color from a predefind color palettes and screen.
Use NuGet package manager.
Add ag.WPF.ColorPicker namespace to XAML file:
xmlns:picker="clr-namespace:ag.WPF.ColorPicker;assembly=ag.WPF.ColorPicker"
Add ColorPicker
<picker:ColorPicker x:Name="_picker" Width="175" VerticalAlignment="Top" Grid.Column="0" Margin="20" SelectedColorChanged="_picker_SelectedColorChanged"/>
Elsewhere in code behind
private void _picker_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs<Color> e) => Background = new SolidColorBrush(e.NewValue);
Represents available ColorPanel views
Field | Value | Description |
---|---|---|
Standard | 0 | Standard view with full controls set available |
Simple | 1 | Simple minimalistic view |
Property | Type | Description | Default value |
---|---|---|---|
SelectedColor | Color | Gets or sets selected color | Red |
ColorString | string | Gets selected color's string representation | |
ButtonVisible | bool | Gets or sets the visibility of the Button |
Event | Description | Remarks |
---|---|---|
SelectedColorChanged | Occurrs when SelectedColor property is changed | OldValue field of RoutedPropertyChangedEventArgs contains an initial color. NewValue of RoutedPropertyChangedEventArgs contains a new color. |
Property | Type | Description | Default value |
---|---|---|---|
SelectedColor | Color | Gets or sets selected color | Red |
ColorString | string | Gets selected color's string representation |
Property | Type | Description | Default value |
---|---|---|---|
PanelView | PanelView | Gets or sets a value that indicates the view of ColorPanel | PanelView.Standard |
TitleCancel | string | Gets or sets a value that indicates the title of Cancel button | Cancel |
TitleApply | string | Gets or sets a value that indicates the title of Apply button | Apply |
TitleShadesAndTints | string | Gets or sets a value that indicates the title of Shades and tints group box | Shades and tints |
TitleColorModes | string | Gets or sets a value that indicates the title of Color modes group box | Color modes |
TitleFormat | string | Gets or sets a value that indicates the title of Format text box | Format |
TitleTabStandard | string | Gets or sets a value that indicates the title of Standard tab | Standard |
TitleTabBasic | string | Gets or sets a value that indicates the title of Basic tab | Basic |
TitleTabCustom | string | Gets or sets a value that indicates the title of Custom tab | Custom |
Event | Description | Remarks |
---|---|---|
SelectedColorChanged | Occurrs when SelectedColor property is changed | OldValue field of RoutedPropertyChangedEventArgs contains an initial color. NewValue of RoutedPropertyChangedEventArgs contains a new color. |