diff --git a/src/client/spark/view/Controls/ColorPicker/ColorPickerPopup.xaml.cs b/src/client/spark/view/Controls/ColorPicker/ColorPickerPopup.xaml.cs index a3e568fcd..a55734853 100644 --- a/src/client/spark/view/Controls/ColorPicker/ColorPickerPopup.xaml.cs +++ b/src/client/spark/view/Controls/ColorPicker/ColorPickerPopup.xaml.cs @@ -40,18 +40,18 @@ namespace mbts.ui.controls { class ColorPickerPopupVM : ViewModelBase, IValueFactory { readonly Property _color; readonly Property _opacity; + ObservableCollection _palettes; bool _bind_opacity_to_alpha; IDisposable _opacity_alpha_binding; public ColorPickerPopupVM() { _color = backing(nameof(color), Colors.Black); _opacity = backing(nameof(opacity), 1.0); - palettes = new ObservableCollection(ColorPalette.all_presets().Select(p => new ColorPaletteVM(p))); } public Color color { get => _color.Value; set => _color.set(value); } public double opacity { get => _opacity.Value; set => _opacity.set(value); } - public ObservableCollection palettes { get; } + public ObservableCollection palettes => _palettes ?? (_palettes = new ObservableCollection(ColorPalette.all_presets().Select(p => new ColorPaletteVM(p)))); public bool bind_opacity_to_alpha { get => _bind_opacity_to_alpha; set {