diff options
author | Bertrand Le Roy <beleroy@microsoft.com> | 2019-03-16 02:18:55 +0300 |
---|---|---|
committer | Bertrand Le Roy <beleroy@microsoft.com> | 2019-03-16 02:18:55 +0300 |
commit | d4d740df5bf6f54eaf0457cead4e88ee194fd7a3 (patch) | |
tree | 95e268ee826f7a98e76835209fecdfd4d260d5db | |
parent | 23165b2faa5f5bbb41bbced3edb3e04468a3f623 (diff) |
Reset previous solid color when resetting a brush property. Fixes #162bleroy-reset-previous-color-on-reset
-rw-r--r-- | Xamarin.PropertyEditing/ViewModels/BrushPropertyViewModel.cs | 7 | ||||
-rw-r--r-- | Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs | 2 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing/ViewModels/BrushPropertyViewModel.cs b/Xamarin.PropertyEditing/ViewModels/BrushPropertyViewModel.cs index b2f7e96..9d382d9 100644 --- a/Xamarin.PropertyEditing/ViewModels/BrushPropertyViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/BrushPropertyViewModel.cs @@ -117,6 +117,13 @@ namespace Xamarin.PropertyEditing.ViewModels OnPropertyChanged (nameof (ResourceSelector)); } + protected override Task SetValueAsync (ValueInfo<CommonBrush> newValue) + { + if (newValue.Source == ValueSource.Unset && Solid?.PreviousSolidBrush != null) + Solid.PreviousSolidBrush = null; + return base.SetValueAsync (newValue); + } + protected override async Task UpdateCurrentValueAsync () { if (BrushTypes == null) diff --git a/Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs b/Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs index 951e848..dbc5aef 100644 --- a/Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs +++ b/Xamarin.PropertyEditing/ViewModels/PropertyViewModel.cs @@ -260,7 +260,7 @@ namespace Xamarin.PropertyEditing.ViewModels return args; } - protected Task SetValueAsync (ValueInfo<TValue> newValue) + protected virtual Task SetValueAsync (ValueInfo<TValue> newValue) { if (this.value == newValue) return Task.CompletedTask; |