Taste in mainview.xaml: < /p>
Code: Select all
< /code>
Befehlsdeklaration in MainViewModel: < /p>
public class MainViewModel : BaseViewModel
{
public ICommand CloseCommand { get; set; }
}
< /code>
Befehlsdefinition in CloseScommand.cs: < /p>
public class CloseCommand : ICommand
{
public event EventHandler CanExecuteChanged;
public bool CanExecute(object parameter)
{
return true;
}
public void Execute(object parameter)
{
System.Windows.Application.Current.Shutdown();
}
}