diff options
author | CartBlanche <savagesoftware@gmail.com> | 2019-07-03 19:00:37 +0300 |
---|---|---|
committer | CartBlanche <savagesoftware@gmail.com> | 2019-07-03 19:00:37 +0300 |
commit | 1e9797a0e06c817373e40cb0edcb2f297c2baab7 (patch) | |
tree | 97e61608b404ef97bc44aa1ecd9cc1ecf20f9313 /Xamarin.PropertyEditing.Mac | |
parent | 50cbb497b21e77c752a808ff406db9ba47cff84f (diff) |
[Mac] If VM changes, reset popupMenu list.
Diffstat (limited to 'Xamarin.PropertyEditing.Mac')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs index 3e3347a..5768136 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs @@ -15,17 +15,23 @@ namespace Xamarin.PropertyEditing.Mac PropertyViewModel viewModel; internal PropertyViewModel ViewModel { - get { return viewModel; } + get { return this.viewModel; } set { if (this.viewModel != null) { this.viewModel.PropertyChanged -= OnPropertyChanged; } this.viewModel = value; + if (this.viewModel != null) { this.viewModel.PropertyChanged += OnPropertyChanged; ValueSourceChanged (this.viewModel.ValueSource); } + + if (this.popUpContextMenu != null) { + this.popUpContextMenu.RemoveAllItems (); + this.popUpContextMenu = null; + } } } |