Skip to content

Instantly share code, notes, and snippets.

@andy51002000
Created October 21, 2017 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andy51002000/b130d76dc6172a423182dd4b0ad020a3 to your computer and use it in GitHub Desktop.
Save andy51002000/b130d76dc6172a423182dd4b0ad020a3 to your computer and use it in GitHub Desktop.
MVVM Model
using System.ComponentModel;
namespace SimpleMVVM.Models
{
public class Movie:INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if( handler != null)
{
PropertyChangedEventArgs args = new PropertyChangedEventArgs(propertyName);
handler(this, args);
}
}
private string name;
private string price;
public string Name
{
get => name;
set
{
name = value;
NotifyPropertyChanged("Name");
}
}
public string Price
{
get => price;
set
{
price = value;
NotifyPropertyChanged("Price");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment