Advertisement
Guest User

ListViewModel.cs

a guest
Nov 21st, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1.     public class ListViewModel : INotifyPropertyChanged {
  2.  
  3.         public event PropertyChangedEventHandler PropertyChanged;
  4.  
  5.         private Games games;
  6.         public Games Games //Set this up for property notifications
  7.         {
  8.             get { return games; }
  9.             set
  10.             {
  11.                 games = value;
  12.                 OnPropertyChanged("Games");
  13.             }
  14.         }
  15.        
  16.         public ListViewModel() {
  17.             Games = new Games {
  18.                 Title = "If things are set here they work",
  19.                 Path = "bbb",
  20.                 Genres = "ccc",
  21.                 Link = "www.google.co.uk",
  22.                 Icon = "ddd",
  23.                 Poster = "eee",
  24.                 Banner = "fff",
  25.             };
  26.         }
  27.  
  28.         //Implement notification call
  29.         private void OnPropertyChanged(string propertyName)
  30.         {
  31.             PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement