Simple. Just create another ICommand
property:
RelayCommand _executecommand2;
public ICommand ExecuteCommand2
{
get
{
if (_executecommand2 == null)
{
_executecommand2 = new RelayCommand(param => Execute2(), param => CanExecute2());
}
return _executecommand2;
}
}
public virtual void Execute2()
{
MainWindow window = new MainWindow();
window.Show();
}
public virtual bool CanExecute2()
{
return true;
}
For using it, you can just bind the ICommand
property to the Command
property of your view's element. Something like:
<Button Command="{Binding ExecuteCommand2}" />