diff --git a/samples/ControlCatalog/Pages/ColorPickerPage.xaml b/samples/ControlCatalog/Pages/ColorPickerPage.xaml index eca52e796a..486a36956f 100644 --- a/samples/ControlCatalog/Pages/ColorPickerPage.xaml +++ b/samples/ControlCatalog/Pages/ColorPickerPage.xaml @@ -51,35 +51,7 @@ HsvColor="{Binding HsvColor, ElementName=ColorSpectrum1}" /> - - - - + Grid.Row="0"> diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs index cf9585dba1..a3267d88f2 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs @@ -5,9 +5,12 @@ using Avalonia.Media; namespace Avalonia.Controls { + /// public partial class ColorView { - // SelectedTab + // SelectedTabIndex + // IsColorModelSelectorVisible + // IsComponentSliderVisible /// /// Defines the property. @@ -81,7 +84,7 @@ namespace Avalonia.Controls public static readonly StyledProperty IsAlphaEnabledProperty = AvaloniaProperty.Register( nameof(IsAlphaEnabled), - false); + true); /// /// Defines the property. @@ -91,6 +94,14 @@ namespace Avalonia.Controls nameof(IsAlphaVisible), true); + /// + /// Defines the property. + /// + public static readonly StyledProperty IsColorComponentsVisibleProperty = + AvaloniaProperty.Register( + nameof(IsColorComponentsVisible), + true); + /// /// Defines the property. /// @@ -108,19 +119,19 @@ namespace Avalonia.Controls true); /// - /// Defines the property. + /// Defines the property. /// - public static readonly StyledProperty IsColorSliderVisibleProperty = + public static readonly StyledProperty IsColorSpectrumVisibleProperty = AvaloniaProperty.Register( - nameof(IsColorSliderVisible), + nameof(IsColorSpectrumVisible), true); /// - /// Defines the property. + /// Defines the property. /// - public static readonly StyledProperty IsColorSpectrumVisibleProperty = + public static readonly StyledProperty IsColorSpectrumSliderVisibleProperty = AvaloniaProperty.Register( - nameof(IsColorSpectrumVisible), + nameof(IsColorSpectrumSliderVisible), true); /// @@ -205,7 +216,7 @@ namespace Avalonia.Controls /// /// /// This property is only applicable to the components tab. - /// The spectrum tab must always be in HSV and the palette tab is pre-defined colors. + /// The spectrum tab must always be in HSV and the palette tab contains only pre-defined colors. /// public ColorModel ColorModel { @@ -288,7 +299,16 @@ namespace Avalonia.Controls } /// - /// Gets or sets a value indicating whether the color palette is visible. + /// Gets or sets a value indicating whether the color components subview/tab is visible. + /// + public bool IsColorComponentsVisible + { + get => GetValue(IsColorComponentsVisibleProperty); + set => SetValue(IsColorComponentsVisibleProperty, value); + } + + /// + /// Gets or sets a value indicating whether the color palette subview/tab is visible. /// public bool IsColorPaletteVisible { @@ -309,20 +329,25 @@ namespace Avalonia.Controls set => SetValue(IsColorPreviewVisibleProperty, value); } - // IsColorComponentsVisible - - public bool IsColorSliderVisible // ColorSpectrumSlider - { - get => GetValue(IsColorSliderVisibleProperty); - set => SetValue(IsColorSliderVisibleProperty, value); - } - + /// + /// Gets or sets a value indicating whether the color spectrum subview/tab is visible. + /// public bool IsColorSpectrumVisible { get => GetValue(IsColorSpectrumVisibleProperty); set => SetValue(IsColorSpectrumVisibleProperty, value); } + /// + /// Gets or sets a value indicating whether the color spectrum's third component slider + /// is visible. + /// + public bool IsColorSpectrumSliderVisible + { + get => GetValue(IsColorSpectrumSliderVisibleProperty); + set => SetValue(IsColorSpectrumSliderVisibleProperty, value); + } + /// /// Gets or sets a value indicating whether color component text inputs are visible. /// diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs index 677cdb8674..534e833631 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorViewTab.cs @@ -1,7 +1,7 @@ namespace Avalonia.Controls { /// - /// Defines a specific tab (subview) within the . + /// Defines a specific subview (tab) within the . /// public enum ColorViewTab { diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml index 079959a775..b3424d2cc1 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml @@ -58,10 +58,11 @@ HsvColor="{Binding $parent[ColorPicker].HsvColor, Mode=TwoWay}" IsAlphaEnabled="{TemplateBinding IsAlphaEnabled}" IsAlphaVisible="{TemplateBinding IsAlphaVisible}" + IsColorComponentsVisible="{TemplateBinding IsColorComponentsVisible}" IsColorPaletteVisible="{TemplateBinding IsColorPaletteVisible}" IsColorPreviewVisible="{TemplateBinding IsColorPreviewVisible}" - IsColorSliderVisible="{TemplateBinding IsColorSliderVisible}" IsColorSpectrumVisible="{TemplateBinding IsColorSpectrumVisible}" + IsColorSpectrumSliderVisible="{TemplateBinding IsColorSpectrumSliderVisible}" IsComponentTextInputVisible="{TemplateBinding IsComponentTextInputVisible}" IsHexInputVisible="{TemplateBinding IsHexInputVisible}" MaxHue="{TemplateBinding MaxHue}" diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml index 1b5230eabb..afc8682a66 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml @@ -121,7 +121,7 @@ - + @@ -150,7 +150,8 @@ HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}" HorizontalAlignment="Center" VerticalAlignment="Stretch" - Margin="0,0,12,0" /> + Margin="0,0,12,0" + IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"/> - + @@ -254,7 +255,7 @@ - + @@ -590,7 +591,7 @@