1. First Create Event Handler in ViewModel
LoginViewModel
2. Handle ViewModel Event in View
LoginView.Xaml.cs
LoginViewModel
public event EventHandler LoginCompleted = delegate { }; public void OnLoginCompleted() { LoginCompleted(this, new EventArgs()); }
2. Handle ViewModel Event in View
LoginView.Xaml.cs
public LoginView()
{
this.DataContext = new LoginViewModel();
(this.DataContext as LoginViewModel).LoginCompleted +=
new EventHandler(LoginViewModel_LoginCompleted);
}
void LoginViewModel_LoginCompleted(object sender, EventArgs e) { //your Coode goes here }
No comments:
Post a Comment