diff options
-rw-r--r-- | Xamarin.PropertyEditing.Windows/PropertyButton.cs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Xamarin.PropertyEditing.Windows/PropertyButton.cs b/Xamarin.PropertyEditing.Windows/PropertyButton.cs index d4d41e7..ef59783 100644 --- a/Xamarin.PropertyEditing.Windows/PropertyButton.cs +++ b/Xamarin.PropertyEditing.Windows/PropertyButton.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using System.Collections; +using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Controls.Primitives; @@ -100,6 +101,7 @@ namespace Xamarin.PropertyEditing.Windows private void OnDataContextChanged (object sender, DependencyPropertyChangedEventArgs e) { if (e.OldValue is PropertyViewModel pvm) { + pvm.PropertyChanged -= OnPropertyChanged; pvm.ResourceRequested -= OnResourceRequested; pvm.CreateBindingRequested -= OnCreateBindingRequested; pvm.CreateResourceRequested -= OnCreateResourceRequested; @@ -107,12 +109,22 @@ namespace Xamarin.PropertyEditing.Windows this.vm = e.NewValue as PropertyViewModel; if (this.vm != null) { + this.vm.PropertyChanged += OnPropertyChanged; this.vm.ResourceRequested += OnResourceRequested; this.vm.CreateBindingRequested += OnCreateBindingRequested; this.vm.CreateResourceRequested += OnCreateResourceRequested; } } + private void OnPropertyChanged (object sender, PropertyChangedEventArgs e) + { + switch (e.PropertyName) { + case nameof(PropertyViewModel.Resource): + OnValueSourceChanged (this.vm.ValueSource); + break; + } + } + private void OnValueSourceChanged (ValueSource source) { if (this.indicator == null) |