All,
Just started w/ MVVM... got few articles that talk abt MVVM... I have 2 queries..
Always INotifyPropertyChanged and ICommand implementation will be like this? or some other changes required?
If I click on some button and need to call some method of model ? How can I achive that?
Thx in advance..
This property is implemented @ model
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
ICommand -- this is implemented @ VM
private ICommand mUpdater;
public ICommand UpdateCommand
{
get
{
if (mUpdater == null)
mUpdater = new Updater();
return mUpdater;
}
set
{
mUpdater = value;
}
}
private class Updater : ICommand
{
#region ICommand Members
public bool CanExecute(object parameter)
{
return true;
}
public event EventHandler CanExecuteChanged;
public void Execute(object parameter)
{
}
#endregion
}