ShowBindingClass.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Media.Imaging;
  8. namespace CCDCountWpf
  9. {
  10. public class ShowBindingClass : INotifyPropertyChanged
  11. {
  12. private string teststring = "测试";
  13. public string TestString
  14. {
  15. get { return teststring; }
  16. set
  17. {
  18. teststring = value;
  19. OnPropertyChanged("TestString");
  20. }
  21. }
  22. private BitmapImage bitmapImage;
  23. public BitmapImage BitmapImage
  24. {
  25. get { return bitmapImage; }
  26. set
  27. {
  28. bitmapImage = value;
  29. OnPropertyChanged("BitmapImage");
  30. }
  31. }
  32. public event PropertyChangedEventHandler PropertyChanged;
  33. protected void OnPropertyChanged(string propertyName)
  34. {
  35. PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  36. }
  37. }
  38. }