Fix ColorPicker ColorPickerPaletteGroup bug

This commit is contained in:
chinboy
2025-09-03 17:21:53 +08:00
parent 589f2ab294
commit 2491fdad53
2 changed files with 5 additions and 18 deletions
+2 -17
View File
@@ -1,14 +1,9 @@
using System.Reactive.Disposables;
using AtomUI.Controls.ColorPickerLang;
using AtomUI.Controls.Themes;
using AtomUI.Data;
using AtomUI.Theme;
using AtomUI.Theme.Data;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Converters;
using Avalonia.Controls.Primitives;
using Avalonia.Data;
using Avalonia.Media;
using Avalonia.VisualTree;
@@ -187,6 +182,8 @@ public class ColorPicker : AbstractColorPicker
_presenter = presenter;
_presenter.ValueChanged += HandleColorPickerViewValueChanged;
_presenter.ColorValueCleared += HandleColorCleared;
var effectiveColor = Value ?? DefaultValue;
_presenter.SetCurrentValue(ColorPickerView.ValueProperty, effectiveColor);
}
}
@@ -201,18 +198,6 @@ public class ColorPicker : AbstractColorPicker
_latestSyncValue = args.NewColor;
}
}
protected override void NotifyFlyoutOpened()
{
if (PickerFlyout is ColorPickerFlyout colorPickerFlyout)
{
var effectiveColor = Value ?? DefaultValue;
if (effectiveColor != null)
{
colorPickerFlyout.SetCurrentValue(ColorPickerFlyout.ValueProperty, effectiveColor);
}
}
}
protected override void NotifyFlyoutClosed()
{
@@ -21,7 +21,9 @@
PaletteGroup="{TemplateBinding PaletteGroup}"
IsVisible="{TemplateBinding IsPaletteGroupEnabled}"
IsMotionEnabled="{TemplateBinding IsMotionEnabled}"/>
<Rectangle Name="Separator" VerticalAlignment="Stretch" Width="1" />
<Rectangle Name="Separator"
VerticalAlignment="Stretch" Width="1"
IsVisible="{TemplateBinding IsPaletteGroupEnabled}"/>
<StackPanel Orientation="Vertical" ClipToBounds="False"
Spacing="{DynamicResource {x:Static atom:SharedTokenKey.SpacingXS}}">
<atom:ColorBlock Name="{x:Static atom:ColorPickerViewThemeConstants.ClearColorPart}"