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

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

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

Loading…
Cancel
Save