PropertyChangedBase.cs 542 B

1234567891011121314151617181920
  1. using System;
  2. using System.ComponentModel;
  3. using System.Windows;
  4. namespace InABox.Wpf.Console;
  5. public class PropertyChangedBase : INotifyPropertyChanged
  6. {
  7. public event PropertyChangedEventHandler PropertyChanged;
  8. protected virtual void OnPropertyChanged(string propertyName)
  9. {
  10. Application.Current.Dispatcher.BeginInvoke((Action)(() =>
  11. {
  12. var handler = PropertyChanged;
  13. if (handler != null)
  14. handler(this, new PropertyChangedEventArgs(propertyName));
  15. }));
  16. }
  17. }