Skip to content

Commit 89bc6e8

Browse files
committed
Changed ContrastOptionsPanel to use ColorPickerButton
1 parent 3037a05 commit 89bc6e8

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

components/ColorAnalyzer/samples/ContrastHelper/ContrastOptionsPane.xaml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<UserControl x:Class="ColorAnalyzerExperiment.Samples.ContrastOptionsPane"
1+
<UserControl x:Class="ColorAnalyzerExperiment.Samples.ContrastOptionsPane"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
@@ -8,22 +8,11 @@
88
mc:Ignorable="d">
99

1010
<StackPanel Spacing="2">
11-
<StackPanel Orientation="Horizontal">
12-
<StackPanel>
13-
<TextBlock Text="Desired Foreground" />
14-
<controls:ColorPicker ColorChanged="Foreground_ColorChanged"
15-
IsColorChannelTextInputVisible="True"
16-
IsColorSliderVisible="True"
17-
Color="White" />
18-
</StackPanel>
19-
<StackPanel>
20-
<TextBlock Text="Background" />
21-
<controls:ColorPicker ColorChanged="Background_ColorChanged"
22-
IsColorChannelTextInputVisible="True"
23-
IsColorSliderVisible="True"
24-
Color="Black" />
25-
</StackPanel>
26-
</StackPanel>
11+
<TextBlock Text="Desired Foreground" />
12+
<controls:ColorPickerButton SelectedColor="{x:Bind DesiredForeground, Mode=TwoWay}"/>
13+
14+
<TextBlock Text="Background" />
15+
<controls:ColorPickerButton SelectedColor="{x:Bind DesiredBackground, Mode=TwoWay}"/>
2716

2817
<Slider MinWidth="256"
2918
HorizontalAlignment="Center"

components/ColorAnalyzer/samples/ContrastHelper/ContrastOptionsPane.xaml.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#if !WINDOWS_UWP
66
using Microsoft.UI.Xaml.Media.Imaging;
77
#elif WINDOWS_UWP
8+
using Windows.UI;
89
using Windows.UI.Xaml.Media.Imaging;
910
#endif
1011

@@ -19,10 +20,22 @@ public partial class ContrastOptionsPane : UserControl
1920
public ContrastOptionsPane(ContrastHelperSampleBase sample)
2021
{
2122
_sample = sample;
22-
23+
2324
this.InitializeComponent();
2425
}
2526

27+
public Color DesiredForeground
28+
{
29+
get => _sample.DesiredForeground;
30+
set => _sample.DesiredForeground = value;
31+
}
32+
33+
public Color DesiredBackground
34+
{
35+
get => _sample.DesiredBackground;
36+
set => _sample.DesiredBackground = value;
37+
}
38+
2639
private void Foreground_ColorChanged(MUXC.ColorPicker sender, MUXC.ColorChangedEventArgs args)
2740
{
2841
// TODO: Disect the colorpicker

0 commit comments

Comments
 (0)