Advertisement
MIkeKaye

MyViewModelx.cs 29Jan

Jan 29th, 2025
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using CommunityToolkit.Mvvm.ComponentModel;
  2. using System.ComponentModel;
  3. using System.Runtime.CompilerServices;
  4.  
  5. namespace MM2.ViewModels;
  6.  
  7. public partial class MyViewModelx : ObservableObject
  8. {
  9.     private DateTime _theDate;
  10.     public DateTime theDate
  11.     {
  12.         get { return _theDate; }
  13.         set
  14.         {
  15.             if (_theDate == value) return;
  16.             _theDate = value;
  17.             OnPropertyChanged();
  18.         }
  19.     }
  20.     private int _anInt;
  21.     public int anInt
  22.     {
  23.         get { return _anInt; }
  24.         set
  25.         {
  26.             if (_anInt == value) return;
  27.             _anInt = value;
  28.             OnPropertyChanged();
  29.         }
  30.     }
  31.     public event PropertyChangedEventHandler PropertyChanged;
  32.     protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
  33.     {
  34.         PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  35.     }
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement