Skip to content

Commit aa6e892

Browse files
authored
Merge branch 'master' into aleader/notifications-registry
2 parents 3b5dfa7 + 8315ffb commit aa6e892

35 files changed

+5963
-56
lines changed

Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@
272272
<Content Include="Icons\More.png" />
273273
<Content Include="Icons\Notifications.png" />
274274
<Content Include="Icons\Services.png" />
275+
<Content Include="SamplePages\ColorPicker\ColorPicker.png" />
275276
<Content Include="SamplePages\TilesBrush\TilesBrush.png" />
276277
<Content Include="SamplePages\Eyedropper\Eyedropper.png" />
277278
<Content Include="SamplePages\OnDevice\OnDevice.png" />
@@ -509,6 +510,12 @@
509510
<Compile Include="SamplePages\AutoFocusBehavior\AutoFocusBehaviorPage.xaml.cs">
510511
<DependentUpon>AutoFocusBehaviorPage.xaml</DependentUpon>
511512
</Compile>
513+
<Compile Include="SamplePages\ColorPicker\ColorPickerButtonPage.xaml.cs">
514+
<DependentUpon>ColorPickerButtonPage.xaml</DependentUpon>
515+
</Compile>
516+
<Compile Include="SamplePages\ColorPicker\ColorPickerPage.xaml.cs">
517+
<DependentUpon>ColorPickerPage.xaml</DependentUpon>
518+
</Compile>
512519
<Compile Include="SamplePages\EnumValuesExtension\EnumValuesExtensionPage.xaml.cs">
513520
<DependentUpon>EnumValuesExtensionPage.xaml</DependentUpon>
514521
</Compile>
@@ -620,6 +627,8 @@
620627
<Content Include="SamplePages\EnumValuesExtension\EnumValuesExtensionCode.bind" />
621628
<Content Include="SamplePages\FocusBehavior\FocusBehaviorXaml.bind" />
622629
<Content Include="SamplePages\AutoFocusBehavior\AutoFocusBehaviorXaml.bind" />
630+
<Content Include="SamplePages\ColorPicker\ColorPickerXaml.bind" />
631+
<Content Include="SamplePages\ColorPicker\ColorPickerButtonXaml.bind" />
623632
</ItemGroup>
624633
<ItemGroup>
625634
<Compile Include="App.xaml.cs">
@@ -993,6 +1002,14 @@
9931002
<SubType>Designer</SubType>
9941003
<Generator>MSBuild:Compile</Generator>
9951004
</Page>
1005+
<Page Include="SamplePages\ColorPicker\ColorPickerButtonPage.xaml">
1006+
<Generator>MSBuild:Compile</Generator>
1007+
<SubType>Designer</SubType>
1008+
</Page>
1009+
<Page Include="SamplePages\ColorPicker\ColorPickerPage.xaml">
1010+
<Generator>MSBuild:Compile</Generator>
1011+
<SubType>Designer</SubType>
1012+
</Page>
9961013
<Page Include="SamplePages\EnumValuesExtension\EnumValuesExtensionPage.xaml">
9971014
<Generator>MSBuild:Compile</Generator>
9981015
<SubType>Designer</SubType>
7.3 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.ColorPickerButtonPage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
5+
xmlns:primitives="using:Microsoft.Toolkit.Uwp.UI.Controls.Primitives"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
9+
mc:Ignorable="d">
10+
11+
<Grid Visibility="Collapsed">
12+
<controls:ColorPickerButton />
13+
<primitives:ColorPickerSlider />
14+
</Grid>
15+
</Page>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using Microsoft.Toolkit.Uwp.UI.Controls;
6+
using Windows.UI.Xaml.Controls;
7+
8+
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
9+
{
10+
/// <summary>
11+
/// A page that shows how to use the <see cref="UI.Controls.ColorPicker"/> control.
12+
/// </summary>
13+
public sealed partial class ColorPickerButtonPage : Page
14+
{
15+
public ColorPickerButtonPage()
16+
{
17+
this.InitializeComponent();
18+
}
19+
}
20+
}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<Page
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
mc:Ignorable="d">
8+
9+
<Page.Resources>
10+
<SolidColorBrush Color="{ThemeResource SystemChromeLowColor}" x:Key="SystemControlForegroundChromeLowBrush"/>
11+
</Page.Resources>
12+
13+
<Grid>
14+
<Grid.RowDefinitions>
15+
<RowDefinition Height="*" />
16+
<RowDefinition Height="*" />
17+
<RowDefinition Height="*" />
18+
<RowDefinition Height="*" />
19+
</Grid.RowDefinitions>
20+
<!-- Example 1 -->
21+
<StackPanel Grid.Row="0"
22+
Orientation="Vertical"
23+
HorizontalAlignment="Center"
24+
VerticalAlignment="Center"
25+
Spacing="20">
26+
<Border Background="{ThemeResource SystemChromeMediumColor}"
27+
CornerRadius="4"
28+
Height="100"
29+
Width="300"
30+
Padding="10">
31+
<TextBlock TextAlignment="Center"
32+
VerticalAlignment="Center">
33+
Box-shaped spectrum <LineBreak />
34+
Alpha channel disabled
35+
</TextBlock>
36+
</Border>
37+
<controls:ColorPickerButton x:Name="ColorPickerButton1"
38+
SelectedColor="Navy">
39+
<controls:ColorPickerButton.ColorPickerStyle>
40+
<Style TargetType="controls:ColorPicker">
41+
<Setter Property="ColorSpectrumShape" Value="Box"/>
42+
<Setter Property="IsAlphaEnabled" Value="False"/>
43+
<Setter Property="IsHexInputVisible" Value="True"/>
44+
</Style>
45+
</controls:ColorPickerButton.ColorPickerStyle>
46+
</controls:ColorPickerButton>
47+
</StackPanel>
48+
<!-- Example 2 -->
49+
<StackPanel Grid.Row="1"
50+
Orientation="Vertical"
51+
HorizontalAlignment="Center"
52+
VerticalAlignment="Center"
53+
Spacing="20">
54+
<Border Background="{ThemeResource SystemChromeMediumColor}"
55+
CornerRadius="4"
56+
Height="100"
57+
Width="300"
58+
Padding="10">
59+
<TextBlock TextAlignment="Center"
60+
VerticalAlignment="Center">
61+
Box-shaped spectrum <LineBreak />
62+
Alpha channel enabled
63+
</TextBlock>
64+
</Border>
65+
<controls:ColorPickerButton x:Name="ColorPickerButton2"
66+
SelectedColor="Green">
67+
<controls:ColorPickerButton.ColorPickerStyle>
68+
<Style TargetType="controls:ColorPicker">
69+
<Setter Property="ColorSpectrumShape" Value="Box"/>
70+
<Setter Property="IsAlphaEnabled" Value="True"/>
71+
<Setter Property="IsHexInputVisible" Value="False"/>
72+
</Style>
73+
</controls:ColorPickerButton.ColorPickerStyle>
74+
</controls:ColorPickerButton>
75+
</StackPanel>
76+
<!-- Example 3 -->
77+
<StackPanel Grid.Row="2"
78+
Orientation="Vertical"
79+
HorizontalAlignment="Center"
80+
VerticalAlignment="Center"
81+
Spacing="20">
82+
<Border Background="{ThemeResource SystemChromeMediumColor}"
83+
CornerRadius="4"
84+
Height="100"
85+
Width="300"
86+
Padding="10">
87+
<TextBlock TextAlignment="Center"
88+
VerticalAlignment="Center">
89+
Ring-shaped spectrum <LineBreak />
90+
Alpha channel enabled
91+
</TextBlock>
92+
</Border>
93+
<controls:ColorPickerButton x:Name="ColorPickerButton3"
94+
SelectedColor="Transparent">
95+
<controls:ColorPickerButton.ColorPickerStyle>
96+
<Style TargetType="controls:ColorPicker">
97+
<Setter Property="ColorSpectrumShape" Value="Ring"/>
98+
<Setter Property="IsAlphaEnabled" Value="True"/>
99+
<Setter Property="IsHexInputVisible" Value="True"/>
100+
</Style>
101+
</controls:ColorPickerButton.ColorPickerStyle>
102+
</controls:ColorPickerButton>
103+
</StackPanel>
104+
<!-- Example 4 -->
105+
<StackPanel Grid.Row="3"
106+
Orientation="Vertical"
107+
HorizontalAlignment="Center"
108+
VerticalAlignment="Center"
109+
Spacing="20">
110+
<Border Background="{ThemeResource SystemChromeMediumColor}"
111+
CornerRadius="4"
112+
Height="100"
113+
Width="300"
114+
Padding="10">
115+
<TextBlock TextAlignment="Center"
116+
VerticalAlignment="Center">
117+
Ring-shaped spectrum <LineBreak />
118+
Alpha channel enabled <LineBreak />
119+
Saturation+Value spectrum channels
120+
</TextBlock>
121+
</Border>
122+
<controls:ColorPickerButton x:Name="ColorPickerButton4"
123+
SelectedColor="Maroon">
124+
<controls:ColorPickerButton.ColorPickerStyle>
125+
<Style TargetType="controls:ColorPicker">
126+
<Setter Property="ColorSpectrumShape" Value="Ring"/>
127+
<Setter Property="ColorSpectrumComponents" Value="SaturationValue"/>
128+
<Setter Property="IsAlphaEnabled" Value="True"/>
129+
<Setter Property="IsHexInputVisible" Value="True"/>
130+
</Style>
131+
</controls:ColorPickerButton.ColorPickerStyle>
132+
</controls:ColorPickerButton>
133+
</StackPanel>
134+
</Grid>
135+
</Page>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.ColorPickerPage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
7+
xmlns:primitives="using:Microsoft.Toolkit.Uwp.UI.Controls.Primitives"
8+
mc:Ignorable="d"
9+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
10+
11+
<Grid
12+
Visibility="Collapsed">
13+
<controls:ColorPicker />
14+
<primitives:ColorPickerSlider />
15+
</Grid>
16+
17+
</Page>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using Microsoft.Toolkit.Uwp.UI.Controls;
6+
using Windows.UI.Xaml.Controls;
7+
8+
namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
9+
{
10+
/// <summary>
11+
/// A page that shows how to use the <see cref="UI.Controls.ColorPicker"/> control.
12+
/// </summary>
13+
public sealed partial class ColorPickerPage : Page
14+
{
15+
public ColorPickerPage()
16+
{
17+
this.InitializeComponent();
18+
}
19+
}
20+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<Page
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
7+
mc:Ignorable="d">
8+
9+
<Page.Resources>
10+
<SolidColorBrush Color="{ThemeResource SystemChromeLowColor}" x:Key="SystemControlForegroundChromeLowBrush"/>
11+
</Page.Resources>
12+
13+
<ScrollViewer>
14+
<StackPanel Orientation="Vertical"
15+
HorizontalAlignment="Center"
16+
Spacing="20">
17+
<!-- Example 1 -->
18+
<Border Background="{ThemeResource SystemChromeMediumColor}"
19+
CornerRadius="4"
20+
Height="100"
21+
Width="300"
22+
Padding="10">
23+
<TextBlock TextAlignment="Center"
24+
VerticalAlignment="Center">
25+
Box-shaped spectrum <LineBreak />
26+
Alpha channel disabled
27+
</TextBlock>
28+
</Border>
29+
<controls:ColorPicker x:Name="ColorPicker1"
30+
Color="Navy"
31+
ColorSpectrumShape="Box"
32+
IsAlphaEnabled="False"
33+
IsHexInputVisible="True" />
34+
<!-- Example 2 -->
35+
<Border Background="{ThemeResource SystemChromeMediumColor}"
36+
CornerRadius="4"
37+
Height="100"
38+
Width="300"
39+
Padding="10">
40+
<TextBlock TextAlignment="Center"
41+
VerticalAlignment="Center">
42+
Box-shaped spectrum <LineBreak />
43+
Alpha channel enabled
44+
</TextBlock>
45+
</Border>
46+
<controls:ColorPicker x:Name="ColorPicker2"
47+
Color="Green"
48+
ColorSpectrumShape="Box"
49+
IsAlphaEnabled="True"
50+
IsHexInputVisible="False" />
51+
<!-- Example 3 -->
52+
<Border Background="{ThemeResource SystemChromeMediumColor}"
53+
CornerRadius="4"
54+
Height="100"
55+
Width="300"
56+
Padding="10">
57+
<TextBlock TextAlignment="Center"
58+
VerticalAlignment="Center">
59+
Ring-shaped spectrum <LineBreak />
60+
Alpha channel enabled
61+
</TextBlock>
62+
</Border>
63+
<controls:ColorPicker x:Name="ColorPickerButton3"
64+
Color="Transparent"
65+
ColorSpectrumShape="Ring"
66+
IsAlphaEnabled="True"
67+
IsHexInputVisible="True" />
68+
<!-- Example 4 -->
69+
<Border Background="{ThemeResource SystemChromeMediumColor}"
70+
CornerRadius="4"
71+
Height="100"
72+
Width="300"
73+
Padding="10">
74+
<TextBlock TextAlignment="Center"
75+
VerticalAlignment="Center">
76+
Ring-shaped spectrum <LineBreak />
77+
Alpha channel enabled <LineBreak />
78+
Saturation+Value spectrum channels
79+
</TextBlock>
80+
</Border>
81+
<controls:ColorPicker x:Name="ColorPickerButton4"
82+
Color="Maroon"
83+
ColorSpectrumShape="Ring"
84+
ColorSpectrumComponents="SaturationValue"
85+
IsAlphaEnabled="True"
86+
IsHexInputVisible="True"/>
87+
</StackPanel>
88+
</ScrollViewer>
89+
</Page>

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,26 @@
3434
"Icon": "/SamplePages/Carousel/Carousel.png",
3535
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/Carousel.md"
3636
},
37+
{
38+
"Name": "ColorPicker",
39+
"Type": "ColorPickerPage",
40+
"Subcategory": "Input",
41+
"About": "An improved color picker control providing more options to select colors.",
42+
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/ColorPicker",
43+
"XamlCodeFile": "ColorPickerXaml.bind",
44+
"Icon": "/SamplePages/ColorPicker/ColorPicker.png",
45+
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/ColorPicker.md"
46+
},
47+
{
48+
"Name": "ColorPickerButton",
49+
"Type": "ColorPickerButtonPage",
50+
"Subcategory": "Input",
51+
"About": "A color picker within a flyout opened by pressing a dropdown button containing the selected color.",
52+
"CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/ColorPicker",
53+
"XamlCodeFile": "/SamplePages/ColorPicker/ColorPickerButtonXaml.bind",
54+
"Icon": "/SamplePages/ColorPicker/ColorPicker.png",
55+
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/controls/ColorPickerButton.md"
56+
},
3757
{
3858
"Name": "AdaptiveGridView",
3959
"Type": "AdaptiveGridViewPage",

0 commit comments

Comments
 (0)