ColorPickerPopupVM initailizes palettes lazily
This commit is contained in:
1 parent
6e9d164d32
commit
d0c978b71c
1 file changed
+2
-2
@@ -40,18 +40,18 @@ namespace mbts.ui.controls {
|
||||
class ColorPickerPopupVM : ViewModelBase, IValueFactory<SolidColorBrush> {
|
||||
readonly Property<Color> _color;
|
||||
readonly Property<double> _opacity;
|
||||
ObservableCollection<ColorPaletteVM> _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<ColorPaletteVM>(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<ColorPaletteVM> palettes { get; }
|
||||
public ObservableCollection<ColorPaletteVM> palettes => _palettes ?? (_palettes = new ObservableCollection<ColorPaletteVM>(ColorPalette.all_presets().Select(p => new ColorPaletteVM(p))));
|
||||
public bool bind_opacity_to_alpha {
|
||||
get => _bind_opacity_to_alpha;
|
||||
set {
|
||||
|
||||
Reference in new issue
Block a user