Browse Source

Fixed add from swatches button

Krzysztof Krysiński 1 year ago
parent
commit
1426dd867a

+ 7 - 7
src/PixiEditor.AvaloniaUI/Views/Palettes/PaletteColorAdder.axaml.cs

@@ -1,4 +1,5 @@
-using System.Collections.Specialized;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
 using System.Linq;
 using Avalonia;
 using Avalonia.Controls;
@@ -22,12 +23,11 @@ internal partial class PaletteColorAdder : UserControl
         set => SetValue(HintColorProperty, value);
     }
 
-    public static readonly StyledProperty<ObservableRangeCollection<PaletteColor>> SwatchesProperty =
-        AvaloniaProperty.Register<PaletteColorAdder, ObservableRangeCollection<PaletteColor>>(
-            nameof(Swatches),
-            default(ObservableRangeCollection<PaletteColor>));
+    public static readonly StyledProperty<ObservableCollection<PaletteColor>> SwatchesProperty =
+        AvaloniaProperty.Register<PaletteColorAdder, ObservableCollection<PaletteColor>>(
+            nameof(Swatches));
 
-    public ObservableRangeCollection<PaletteColor> Swatches
+    public ObservableCollection<PaletteColor> Swatches
     {
         get => GetValue(SwatchesProperty);
         set => SetValue(SwatchesProperty, value);
@@ -87,7 +87,7 @@ internal partial class PaletteColorAdder : UserControl
         }
     }
 
-    private static void OnSwatchesChanged(AvaloniaPropertyChangedEventArgs<ObservableRangeCollection<PaletteColor>> e)
+    private static void OnSwatchesChanged(AvaloniaPropertyChangedEventArgs<ObservableCollection<PaletteColor>> e)
     {
         PaletteColorAdder adder = (PaletteColorAdder)e.Sender;
         if (adder == null || adder.Swatches == null) return;

+ 4 - 3
src/PixiEditor.AvaloniaUI/Views/Palettes/PaletteViewer.axaml.cs

@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.IO;
 using System.Linq;
 using System.Threading.Tasks;
@@ -29,11 +30,11 @@ namespace PixiEditor.AvaloniaUI.Views.Palettes;
 /// </summary>
 internal partial class PaletteViewer : UserControl
 {
-    public static readonly StyledProperty<ObservableRangeCollection<PaletteColor>> SwatchesProperty =
-        AvaloniaProperty.Register<PaletteViewer, ObservableRangeCollection<PaletteColor>>(
+    public static readonly StyledProperty<ObservableCollection<PaletteColor>> SwatchesProperty =
+        AvaloniaProperty.Register<PaletteViewer, ObservableCollection<PaletteColor>>(
             nameof(Swatches));
 
-    public ObservableRangeCollection<PaletteColor> Swatches
+    public ObservableCollection<PaletteColor> Swatches
     {
         get => GetValue(SwatchesProperty);
         set => SetValue(SwatchesProperty, value);