Skip to content

Commit 3a90f5e

Browse files
Merge pull request #112 from atc-net/feature/ColorPicker
Feature/color picker
2 parents b2cf394 + 3ca22d6 commit 3a90f5e

File tree

119 files changed

+3356
-362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+3356
-362
lines changed

.editorconfig

+2
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,8 @@ dotnet_diagnostic.MA0011.severity = none # Use an overload of 'ToStrin
518518
dotnet_diagnostic.MA0041.severity = none # Make property static (deprecated, use CA1822 instead)
519519
dotnet_diagnostic.MA0131.severity = none # ArgumentNullException.ThrowIfNull should not be used with non-nullable types
520520

521+
dotnet_diagnostic.SA1010.severity = none # Opening square brackets must be spaced correctly
522+
521523
dotnet_diagnostic.S1144.severity = none # Remove the unused internal class
522524
dotnet_diagnostic.S2094.severity = none # Remove this empty class, write its code or make it an "interface"
523525
dotnet_diagnostic.S2445.severity = none # Do not lock on writable field 'items', use a readonly field instead

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ but just with a xaml-markup extension to lookup the value by key.
217217
| | BackgroundToForegroundValueConverter | | |
218218
| Brush -> Color | BrushToColorValueConverter | Brushs.Green -> Colors.Green | Colors.Green -> Brushs.Green |
219219
| Color -> Brush | ColorToBrushValueConverter | Colors.Green -> Brushs.Green | Brushs.Green -> Colors.Green |
220+
| Color -> SolidColor | ColorToSolidColorValueConverter | Colors.Green -> Colors.Green | Not supported |
221+
| Color -> String | ColorHexToColorValueConverter | "#FF00FF00" -> "Green" | "Green" -> "#FF00FF00" |
220222
| Hex-Color -> Color-Key | HexColorToColorKeyValueConverter | "#FF00FF00" -> "Green" | "Green" -> Brushs.Green |
221223
| Enum -> String | EnumDescriptionToStringValueConverter | DayOfWeek.Monday -> Monday | Not supported |
222224
| Int -> Visibility | IntegerGreaterThenZeroToVisibilityVisibleValueConverter | 0 -> Collapsed and 1 -> Visible | Not supported |

sample/Atc.Wpf.Sample/App.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ await host
112112

113113
ThemeManager.Current.ChangeTheme(
114114
Current,
115-
"Light.Blue");
115+
"Dark.Blue");
116116

117117
var mainWindow = host
118118
.Services
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<UserControl
2+
x:Class="Atc.Wpf.Sample.SamplesWpfControls.BaseControls.ColorPickerView"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
d:DesignHeight="450"
9+
d:DesignWidth="800"
10+
mc:Ignorable="d">
11+
12+
<atc:AutoGrid Columns="*" Rows="Auto,*">
13+
14+
<GroupBox
15+
Margin="0,0,0,10"
16+
Padding="10"
17+
Header="Features">
18+
<atc:GridEx Columns="Auto,10,300,10,Auto">
19+
<TextBlock
20+
Grid.Column="0"
21+
VerticalAlignment="Center"
22+
FontSize="18"
23+
Text="Binding to the first usage 'MyColorPicker1':" />
24+
<Rectangle
25+
Grid.Column="2"
26+
Width="100"
27+
Height="32"
28+
Fill="{Binding ElementName=MyColorPicker1, Path=BrushValue}" />
29+
</atc:GridEx>
30+
</GroupBox>
31+
32+
<GroupBox Header="Usage">
33+
<ScrollViewer>
34+
<atc:GridEx Columns="*,*" ShowGridLines="True">
35+
<atc:UniformSpacingPanel
36+
Grid.Column="0"
37+
Orientation="Vertical"
38+
Spacing="10">
39+
40+
<atc:ColorPicker x:Name="MyColorPicker1" ColorValue="Green" />
41+
42+
<atc:ColorPicker BrushValue="Blue" />
43+
44+
</atc:UniformSpacingPanel>
45+
<atc:UniformSpacingPanel
46+
Grid.Column="1"
47+
Orientation="Vertical"
48+
Spacing="10">
49+
50+
<atc:ColorPicker ColorValue="DarkMagenta" RenderColorIndicatorType="Circle" />
51+
52+
<atc:ColorPicker BrushValue="DarkOrange" RenderColorIndicatorType="Circle" />
53+
54+
</atc:UniformSpacingPanel>
55+
</atc:GridEx>
56+
</ScrollViewer>
57+
</GroupBox>
58+
</atc:AutoGrid>
59+
60+
</UserControl>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Atc.Wpf.Sample.SamplesWpfControls.BaseControls;
2+
3+
/// <summary>
4+
/// Interaction logic for ColorPickerView.
5+
/// </summary>
6+
public partial class ColorPickerView : UserControl
7+
{
8+
public ColorPickerView()
9+
{
10+
InitializeComponent();
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<UserControl
2+
x:Class="Atc.Wpf.Sample.SamplesWpfControls.ColorControls.AdvancedColorPickerView"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
6+
xmlns:colorControls="clr-namespace:Atc.Wpf.Controls.ColorControls;assembly=Atc.Wpf.Controls"
7+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
d:DesignHeight="750"
10+
d:DesignWidth="850"
11+
mc:Ignorable="d">
12+
13+
<atc:AutoGrid Columns="*" Rows="Auto,*">
14+
15+
<GroupBox
16+
Margin="0,0,0,10"
17+
Padding="10"
18+
Header="Features">
19+
<atc:GridEx Columns="Auto,10,150,10,Auto,10,Auto,10,Auto">
20+
<TextBlock
21+
Grid.Column="0"
22+
VerticalAlignment="Center"
23+
FontSize="18"
24+
Text="Color:" />
25+
<Rectangle
26+
Grid.Column="2"
27+
Width="100"
28+
Height="32"
29+
Fill="{Binding ElementName=UcAdvancedColorPicker, Path=ColorAsBrush}" />
30+
<WrapPanel Grid.Column="4" Orientation="Vertical">
31+
<atc:LabelCheckBox
32+
HideAreas="All"
33+
IsChecked="{Binding ElementName=UcAdvancedColorPicker, Path=ShowSaturationBrightnessPicker}"
34+
LabelText="Show Saturation/Brightness"
35+
LabelWidthNumber="150"
36+
LabelWidthSizeDefinition="Pixel" />
37+
<atc:LabelCheckBox
38+
HideAreas="All"
39+
IsChecked="{Binding ElementName=UcAdvancedColorPicker, Path=ShowAvailableColors}"
40+
LabelText="Show Advanced Colors"
41+
LabelWidthNumber="150"
42+
LabelWidthSizeDefinition="Pixel" />
43+
<atc:LabelCheckBox
44+
HideAreas="All"
45+
IsChecked="{Binding ElementName=UcAdvancedColorPicker, Path=ShowStandardColors}"
46+
LabelText="Show Standard Colors"
47+
LabelWidthNumber="150"
48+
LabelWidthSizeDefinition="Pixel" />
49+
</WrapPanel>
50+
<WrapPanel Grid.Column="6" Orientation="Vertical">
51+
<atc:LabelCheckBox
52+
HideAreas="All"
53+
IsChecked="{Binding ElementName=UcAdvancedColorPicker, Path=ShowHueSlider}"
54+
LabelText="Show Hue-Slider"
55+
LabelWidthNumber="150"
56+
LabelWidthSizeDefinition="Pixel" />
57+
<atc:LabelCheckBox
58+
HideAreas="All"
59+
IsChecked="{Binding ElementName=UcAdvancedColorPicker, Path=ShowTransparencySlider}"
60+
LabelText="Show Transparency-Slider"
61+
LabelWidthNumber="150"
62+
LabelWidthSizeDefinition="Pixel" />
63+
</WrapPanel>
64+
<WrapPanel Grid.Column="8" Orientation="Vertical">
65+
<atc:LabelCheckBox
66+
HideAreas="All"
67+
IsChecked="{Binding ElementName=UcAdvancedColorPicker, Path=ShowBeforeAfterColorResult}"
68+
LabelText="Show Before/After"
69+
LabelWidthNumber="150"
70+
LabelWidthSizeDefinition="Pixel" />
71+
<atc:LabelCheckBox
72+
HideAreas="All"
73+
IsChecked="{Binding ElementName=UcAdvancedColorPicker, Path=ShowHsv}"
74+
LabelText="Show HSV"
75+
LabelWidthNumber="150"
76+
LabelWidthSizeDefinition="Pixel" />
77+
<atc:LabelCheckBox
78+
HideAreas="All"
79+
IsChecked="{Binding ElementName=UcAdvancedColorPicker, Path=ShowRgba}"
80+
LabelText="Show RGBA"
81+
LabelWidthNumber="150"
82+
LabelWidthSizeDefinition="Pixel" />
83+
<atc:LabelCheckBox
84+
HideAreas="All"
85+
IsChecked="{Binding ElementName=UcAdvancedColorPicker, Path=ShowArgb}"
86+
LabelText="Show ARGB"
87+
LabelWidthNumber="150"
88+
LabelWidthSizeDefinition="Pixel" />
89+
</WrapPanel>
90+
</atc:GridEx>
91+
</GroupBox>
92+
93+
<GroupBox Header="Usage">
94+
<ScrollViewer>
95+
96+
<colorControls:AdvancedColorPicker x:Name="UcAdvancedColorPicker" />
97+
98+
</ScrollViewer>
99+
</GroupBox>
100+
</atc:AutoGrid>
101+
102+
</UserControl>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Atc.Wpf.Sample.SamplesWpfControls.ColorControls;
2+
3+
/// <summary>
4+
/// Interaction logic for AdvancedColorPickerView.
5+
/// </summary>
6+
public partial class AdvancedColorPickerView
7+
{
8+
public AdvancedColorPickerView()
9+
{
10+
InitializeComponent();
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<UserControl
2+
x:Class="Atc.Wpf.Sample.SamplesWpfControls.ColorControls.HueSliderView"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
6+
xmlns:colorControls="clr-namespace:Atc.Wpf.Controls.ColorControls;assembly=Atc.Wpf.Controls"
7+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
d:DesignHeight="450"
10+
d:DesignWidth="800"
11+
mc:Ignorable="d">
12+
13+
<atc:AutoGrid Columns="*" Rows="Auto,*">
14+
15+
<GroupBox
16+
Margin="0,0,0,10"
17+
Padding="10"
18+
Header="Features">
19+
<atc:GridEx Columns="Auto,10,300,10,Auto">
20+
<TextBlock
21+
Grid.Column="0"
22+
VerticalAlignment="Center"
23+
FontSize="18"
24+
Text="Binding to the first usage 'MyHueSlider1':" />
25+
<TextBlock
26+
Grid.Column="2"
27+
Width="100"
28+
Height="32"
29+
Text="{Binding ElementName=MyHueSlider1, Path=Hue}" />
30+
</atc:GridEx>
31+
</GroupBox>
32+
33+
<GroupBox Header="Usage">
34+
<ScrollViewer>
35+
<atc:GridEx Columns="*,*" ShowGridLines="True">
36+
<atc:UniformSpacingPanel
37+
Grid.Column="0"
38+
Orientation="Vertical"
39+
Spacing="10">
40+
41+
<colorControls:HueSlider
42+
x:Name="MyHueSlider1"
43+
Width="50"
44+
Height="200" />
45+
46+
</atc:UniformSpacingPanel>
47+
<atc:UniformSpacingPanel
48+
Grid.Column="1"
49+
Orientation="Vertical"
50+
Spacing="10">
51+
52+
<colorControls:HueSlider Width="50" Height="200" />
53+
54+
</atc:UniformSpacingPanel>
55+
</atc:GridEx>
56+
</ScrollViewer>
57+
</GroupBox>
58+
</atc:AutoGrid>
59+
60+
</UserControl>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Atc.Wpf.Sample.SamplesWpfControls.ColorControls;
2+
3+
/// <summary>
4+
/// Interaction logic for HueSliderView.
5+
/// </summary>
6+
public partial class HueSliderView
7+
{
8+
public HueSliderView()
9+
{
10+
InitializeComponent();
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<UserControl
2+
x:Class="Atc.Wpf.Sample.SamplesWpfControls.ColorControls.SaturationBrightnessPickerView"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
6+
xmlns:colorControls="clr-namespace:Atc.Wpf.Controls.ColorControls;assembly=Atc.Wpf.Controls"
7+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
d:DesignHeight="450"
10+
d:DesignWidth="800"
11+
mc:Ignorable="d">
12+
13+
<atc:AutoGrid Columns="*" Rows="Auto,*">
14+
15+
<GroupBox
16+
Margin="0,0,0,10"
17+
Padding="10"
18+
Header="Features">
19+
<atc:GridEx Columns="Auto,10,300,10,Auto">
20+
<TextBlock
21+
Grid.Column="0"
22+
VerticalAlignment="Center"
23+
FontSize="18"
24+
Text="Binding to the first usage 'MySaturationBrightnessPicker1':" />
25+
<Rectangle
26+
Grid.Column="2"
27+
Width="100"
28+
Height="32"
29+
Fill="{Binding ElementName=MySaturationBrightnessPicker1, Path=BrushValue}" />
30+
</atc:GridEx>
31+
</GroupBox>
32+
33+
<GroupBox Header="Usage">
34+
<ScrollViewer>
35+
<atc:GridEx Columns="*,*" ShowGridLines="True">
36+
<atc:UniformSpacingPanel
37+
Grid.Column="0"
38+
Orientation="Vertical"
39+
Spacing="10">
40+
41+
<colorControls:SaturationBrightnessPicker x:Name="MySaturationBrightnessPicker1" />
42+
43+
</atc:UniformSpacingPanel>
44+
<atc:UniformSpacingPanel
45+
Grid.Column="1"
46+
Orientation="Vertical"
47+
Spacing="10">
48+
49+
<colorControls:SaturationBrightnessPicker />
50+
51+
</atc:UniformSpacingPanel>
52+
</atc:GridEx>
53+
</ScrollViewer>
54+
</GroupBox>
55+
</atc:AutoGrid>
56+
57+
</UserControl>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace Atc.Wpf.Sample.SamplesWpfControls.ColorControls;
2+
3+
/// <summary>
4+
/// Interaction logic for SaturationBrightnessPickerView.
5+
/// </summary>
6+
public partial class SaturationBrightnessPickerView
7+
{
8+
public SaturationBrightnessPickerView()
9+
{
10+
InitializeComponent();
11+
}
12+
}

0 commit comments

Comments
 (0)