in my project i have a login page named login.xaml and i had loginViewModel.cs for using MVVM Approach.. At beginning i wrote this.dialogResult=true in my code-behind page(login.xaml.cs) and use the code means it closes the childwindow.. here i need to close the childwindow(login.xaml) from viewmodel(loginviewmodel).
login.xaml:
private void btnLogin_Click(object sender, RoutedEventArgs e)
{
if (txtuser.Text.Trim() != "" && txtpass.Password != "")
{
(DataContext as LoginViewModel).UserValidation(txtuser.Text.Trim(),txtpass.Password.Trim());
}
}
loginviewmodel.cs:
public void UserValidation(string name, string pass)
{
IsBusy =true;
uname=name;
pword=pass;
// ----* (Follow * for the continuation )
}
*--> here i need to close the childwindow.. how to close it..