diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs')
-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; + } } } |