Browse Source

Only disable alpha editing controls when IsAlphaEnabled is false

Rely on IsAlphaVisible for visibility
pull/8215/head
robloo 4 years ago
parent
commit
9e1a6253b6
  1. 6
      src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs
  2. 20
      src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml

6
src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs

@ -270,7 +270,7 @@ namespace Avalonia.Controls
/// <summary>
/// Gets or sets a value indicating whether the alpha component is enabled.
/// When disabled (set to false) the alpha component will be fixed to maximum and
/// editing controls hidden.
/// editing controls disabled.
/// </summary>
public bool IsAlphaEnabled
{
@ -357,7 +357,7 @@ namespace Avalonia.Controls
/// </summary>
/// <remarks>
/// All color components are controlled by this property but alpha can also be
/// controlled with <see cref="IsAlphaEnabled"/> and <see cref="IsAlphaVisible"/>.
/// controlled with <see cref="IsAlphaVisible"/>.
/// </remarks>
public bool IsComponentSliderVisible
{
@ -370,7 +370,7 @@ namespace Avalonia.Controls
/// </summary>
/// <remarks>
/// All color components are controlled by this property but alpha can also be
/// controlled with <see cref="IsAlphaEnabled"/> and <see cref="IsAlphaVisible"/>.
/// controlled with <see cref="IsAlphaVisible"/>.
/// </remarks>
public bool IsComponentTextInputVisible
{

20
src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml

@ -187,11 +187,10 @@
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
HorizontalAlignment="Center"
VerticalAlignment="Stretch"
Margin="12,0,0,0">
Margin="12,0,0,0"
IsEnabled="{TemplateBinding IsAlphaEnabled}">
<primitives:ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="IsAlphaEnabled" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="IsAlphaVisible" />
</MultiBinding>
@ -564,7 +563,8 @@
BorderBrush="{DynamicResource TextControlBorderBrush}"
BorderThickness="1,1,0,1"
CornerRadius="4,0,0,4"
VerticalAlignment="Center">
VerticalAlignment="Center"
IsEnabled="{TemplateBinding IsAlphaEnabled}">
<TextBlock x:Name="AlphaComponentTextBlock"
Foreground="{DynamicResource TextControlForegroundDisabled}"
FontWeight="SemiBold"
@ -573,8 +573,6 @@
VerticalAlignment="Center" />
<Border.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="IsAlphaEnabled" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="IsAlphaVisible" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
@ -595,11 +593,10 @@
NumberFormat="{StaticResource ComponentNumberFormatInfo}"
Minimum="{Binding Minimum, ElementName=AlphaComponentSlider}"
Maximum="{Binding Maximum, ElementName=AlphaComponentSlider}"
Value="{Binding Value, ElementName=AlphaComponentSlider}">
Value="{Binding Value, ElementName=AlphaComponentSlider}"
IsEnabled="{TemplateBinding IsAlphaEnabled}">
<NumericUpDown.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="IsAlphaEnabled" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="IsAlphaVisible" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
@ -618,11 +615,10 @@
ColorModel="{TemplateBinding ColorModel, Mode=OneWay}"
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center">
VerticalAlignment="Center"
IsEnabled="{TemplateBinding IsAlphaEnabled}">
<primitives:ColorSlider.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="IsAlphaEnabled" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"
Path="IsAlphaVisible" />
<Binding RelativeSource="{RelativeSource TemplatedParent}"

Loading…
Cancel
Save