diff options
Diffstat (limited to 'Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs')
-rw-r--r-- | Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs index 17581f1..012fbc7 100644 --- a/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs +++ b/Xamarin.PropertyEditing.Mac/Controls/Custom/PropertyButton.cs @@ -18,14 +18,15 @@ namespace Xamarin.PropertyEditing.Mac { get { return viewModel; } set { - if (viewModel != null) { - viewModel.PropertyChanged -= OnPropertyChanged; + if (this.viewModel != null) { + this.viewModel.PropertyChanged -= OnPropertyChanged; } - viewModel = value; - viewModel.PropertyChanged += OnPropertyChanged; - - ValueSourceChanged (viewModel.ValueSource); + this.viewModel = value; + if (this.viewModel != null) { + this.viewModel.PropertyChanged += OnPropertyChanged; + ValueSourceChanged (this.viewModel.ValueSource); + } } } |