Created
October 21, 2017 08:24
-
-
Save andy51002000/b130d76dc6172a423182dd4b0ad020a3 to your computer and use it in GitHub Desktop.
MVVM Model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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