From 7b69d2ae5744f97257a56d1d09dac98b6edd5e31 Mon Sep 17 00:00:00 2001 From: robloo Date: Sun, 16 Oct 2022 12:17:47 -0400 Subject: [PATCH] Revert "Add and implement IsHostedInColorPicker property to ColorView" This reverts commit 2575a10fb09677ac3f131ab3715b20c46b588397. --- .../ColorPicker/ColorPicker.cs | 3 +++ .../ColorView/ColorView.Properties.cs | 24 ------------------- .../ColorView/ColorView.cs | 20 ---------------- .../Themes/Fluent/ColorPicker.xaml | 4 ---- 4 files changed, 3 insertions(+), 48 deletions(-) diff --git a/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs index 92d8535272..39369bcbdb 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorPicker/ColorPicker.cs @@ -11,6 +11,9 @@ /// public ColorPicker() : base() { + // Completely ignore property changes here + // The ColorView in the control template is responsible to manage this + base.ignorePropertyChanged = true; } } } diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs index d1ee375e28..b76059037b 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.Properties.cs @@ -148,14 +148,6 @@ namespace Avalonia.Controls nameof(IsHexInputVisible), true); - /// - /// Defines the property. - /// - public static readonly StyledProperty IsHostedInColorPickerProperty = - AvaloniaProperty.Register( - nameof(IsHostedInColorPicker), - false); - /// /// Defines the property. /// @@ -403,22 +395,6 @@ namespace Avalonia.Controls set => SetValue(IsHexInputVisibleProperty, value); } - /// - /// Gets or sets a value indicating whether this is hosted - /// inside a 's control template. - /// - /// - /// This is a special property to change how the internally - /// processes property updates. When a is hosted within a - /// , it does not need to handle most property changes. - /// Instead, the primary calculations are done within the itself. - /// - public bool IsHostedInColorPicker - { - get => GetValue(IsHostedInColorPickerProperty); - set => SetValue(IsHostedInColorPickerProperty, value); - } - /// public int MaxHue { diff --git a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs index b0d5250c50..89f1afb1ac 100644 --- a/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs +++ b/src/Avalonia.Controls.ColorPicker/ColorView/ColorView.cs @@ -206,26 +206,6 @@ namespace Avalonia.Controls return; } - // Special handling for when hosted within a ColorPicker and the ColorPicker is - // responsible for most of the internal processing and property updates. - if (IsHostedInColorPicker) - { - if (change.Property == ColorProperty || - change.Property == HsvColorProperty) - { - ignorePropertyChanged = true; - - // The Hex text isn't currently bound with the ColorPicker and therefore - // must still be updated here. - SetColorToHexTextBox(); - - ignorePropertyChanged = false; - } - - base.OnPropertyChanged(change); - return; - } - // Always keep the two color properties in sync if (change.Property == ColorProperty) { diff --git a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml index acdd06480f..74a1df4991 100644 --- a/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml +++ b/src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml @@ -43,11 +43,7 @@ -