Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color picker fixes #4134

Merged
merged 8 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,11 @@
<SolidColorBrush Color="{ThemeResource SystemChromeLowColor}" x:Key="SystemControlForegroundChromeLowBrush"/>
</Page.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Example 1 -->
<StackPanel Grid.Row="0"
Orientation="Vertical"
<ScrollViewer>
<StackPanel Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="20">
<!-- Example 1 -->
<Border Background="{ThemeResource SystemChromeMediumColor}"
CornerRadius="4"
Height="100"
Expand All @@ -44,13 +36,7 @@
</Style>
</controls:ColorPickerButton.ColorPickerStyle>
</controls:ColorPickerButton>
</StackPanel>
<!-- Example 2 -->
<StackPanel Grid.Row="1"
Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="20">
<!-- Example 2 -->
<Border Background="{ThemeResource SystemChromeMediumColor}"
CornerRadius="4"
Height="100"
Expand All @@ -72,13 +58,7 @@
</Style>
</controls:ColorPickerButton.ColorPickerStyle>
</controls:ColorPickerButton>
</StackPanel>
<!-- Example 3 -->
<StackPanel Grid.Row="2"
Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="20">
<!-- Example 3 -->
<Border Background="{ThemeResource SystemChromeMediumColor}"
CornerRadius="4"
Height="100"
Expand All @@ -100,13 +80,7 @@
</Style>
</controls:ColorPickerButton.ColorPickerStyle>
</controls:ColorPickerButton>
</StackPanel>
<!-- Example 4 -->
<StackPanel Grid.Row="3"
Orientation="Vertical"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="20">
<!-- Example 4 -->
<Border Background="{ThemeResource SystemChromeMediumColor}"
CornerRadius="4"
Height="100"
Expand All @@ -130,6 +104,32 @@
</Style>
</controls:ColorPickerButton.ColorPickerStyle>
</controls:ColorPickerButton>
<!-- Example 5 -->
<Border Background="{ThemeResource SystemChromeMediumColor}"
CornerRadius="4"
Height="100"
Width="300"
Padding="10">
<TextBlock TextAlignment="Center"
VerticalAlignment="Center">
Ring-shaped spectrum <LineBreak />
Alpha channel enabled <LineBreak />
Only Color Palette Shown
</TextBlock>
</Border>
<controls:ColorPickerButton x:Name="ColorPickerButton5"
SelectedColor="Teal">
<controls:ColorPickerButton.ColorPickerStyle>
<Style TargetType="controls:ColorPicker">
<Setter Property="ColorSpectrumShape" Value="Ring"/>
<Setter Property="IsAlphaEnabled" Value="True"/>
<Setter Property="IsHexInputVisible" Value="True"/>
<Setter Property="IsColorSpectrumVisible" Value="False"/>
<Setter Property="IsColorPaletteVisible" Value="True"/>
<Setter Property="IsColorChannelTextInputVisible" Value="False"/>
</Style>
</controls:ColorPickerButton.ColorPickerStyle>
</controls:ColorPickerButton>
</StackPanel>
</Grid>
</ScrollViewer>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
Alpha channel enabled
</TextBlock>
</Border>
<controls:ColorPicker x:Name="ColorPickerButton3"
<controls:ColorPicker x:Name="ColorPicker3"
Color="Transparent"
ColorSpectrumShape="Ring"
IsAlphaEnabled="True"
Expand All @@ -78,12 +78,33 @@
Saturation+Value spectrum channels
</TextBlock>
</Border>
<controls:ColorPicker x:Name="ColorPickerButton4"
<controls:ColorPicker x:Name="ColorPicker4"
Color="Maroon"
ColorSpectrumShape="Ring"
ColorSpectrumComponents="SaturationValue"
IsAlphaEnabled="True"
IsHexInputVisible="True"/>
<!-- Example 5 -->
<Border Background="{ThemeResource SystemChromeMediumColor}"
CornerRadius="4"
Height="100"
Width="300"
Padding="10">
<TextBlock TextAlignment="Center"
VerticalAlignment="Center">
Ring-shaped spectrum <LineBreak />
Alpha channel enabled <LineBreak />
Only Color Palette Shown
</TextBlock>
</Border>
<controls:ColorPicker x:Name="ColorPicker5"
Color="Teal"
ColorSpectrumShape="Ring"
IsAlphaEnabled="True"
IsHexInputVisible="True"
IsColorSpectrumVisible="False"
IsColorPaletteVisible="True"
IsColorChannelTextInputVisible="False"/>
</StackPanel>
</ScrollViewer>
</Page>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public partial class ColorPicker
nameof(CustomPaletteColors),
typeof(ObservableCollection<Windows.UI.Color>),
typeof(ColorPicker),
new PropertyMetadata(null));
new PropertyMetadata(
null,
(s, e) => (s as ColorPicker)?.OnDependencyPropertyChanged(s, e)));

/// <summary>
/// Gets the list of custom palette colors.
Expand All @@ -38,7 +40,9 @@ public ObservableCollection<Windows.UI.Color> CustomPaletteColors
nameof(CustomPaletteColumnCount),
typeof(int),
typeof(ColorPicker),
new PropertyMetadata(4));
new PropertyMetadata(
4,
(s, e) => (s as ColorPicker)?.OnDependencyPropertyChanged(s, e)));

/// <summary>
/// Gets or sets the number of colors in each row (section) of the custom color palette.
Expand All @@ -64,7 +68,9 @@ public int CustomPaletteColumnCount
nameof(CustomPalette),
typeof(IColorPalette),
typeof(ColorPicker),
new PropertyMetadata(null));
new PropertyMetadata(
null,
(s, e) => (s as ColorPicker)?.OnDependencyPropertyChanged(s, e)));

/// <summary>
/// Gets or sets the custom color palette.
Expand All @@ -91,7 +97,9 @@ public IColorPalette CustomPalette
nameof(IsColorPaletteVisible),
typeof(bool),
typeof(ColorPicker),
new PropertyMetadata(true));
new PropertyMetadata(
true,
(s, e) => (s as ColorPicker)?.OnDependencyPropertyChanged(s, e)));

/// <summary>
/// Gets or sets a value indicating whether the color palette is visible.
Expand Down
Loading