New to MVVM. I haven't used any MVVM framework (WAF/MVVM Light) .I use relayCommand class from Josh Smith.
Got two forms , Win_Login (btnCancel and btnNext),Other one a selection form with combobox and two buttons(btnBack,btnNext) - Where user select stockticker like GOOG,MSFT etc.
I wrote a basic skeleton of View, and ViewModel for login and selection form.
What I want to achieve is on succesfull login , close the Login view and open Selection form, and click on (btnBack) should show loginForm again.Windows being Singleton.
I set view's dataContext like
<Window
x:Class="Ticker.Win_Login"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Ticker"
Title="Ticker-Login" Height="312" Width="394" WindowStartupLocation="CenterScreen" Background="#F9FBF4" >
<Window.DataContext>
<local:Win_LoginViewModel/>
</Window.DataContext>
<Grid></Grid
in the Win_LoginViewModel
private void LoginExecute()
{
if (!CanLoginExecute()) return;
try
{
//how I'll call close the current view
//how I'll call selectTicker view
}
catch (Exception)
{
throw;
}
}
in Win_SelectTickerViewModel
private Boolean CanBackExecute()
{
return true;
}
private void BackExecute()
{
if (!CanCancelExecute())
{
return;
}
//how I'll implement back here.
}
I'd really appreciate if anyone can help me with some simple solution for given scenario (pbbly with some sample code).