Capacitación básica en Computación
Por Andrew Byrne
Figura 1 Un simple ViewModel
http://msdn.microsoft.com/es-es/magazine/jj190802.aspx
código:
- public class SimpleViewModel : INotifyPropertyChanged
- {
- private string _myText = ”Initial Value”;
- public string MyText
- {
- get
- {
- return _myText;
- }
- set
- {
- if (value != _myText)
- {
- _myText = value;
- NotifyPropertyChanged(“MyText”);
- }
- }
- }
- public event PropertyChangedEventHandler PropertyChanged;
- private void NotifyPropertyChanged(string PropertyName)
- {
- if (PropertyChanged != null)
- {
- PropertyChanged(this,
- new PropertyChangedEventArgs(PropertyName));
- }
- }
%d bloggers like this:
No comments:
Post a Comment