using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; namespace WpfStyleableWindow.StyleableWindow { public class WindowMinimizeCommand :ICommand { public bool CanExecute(object parameter) { return true; } #pragma warning disable 0067 public event EventHandler CanExecuteChanged; #pragma warning restore 0067 public void Execute(object parameter) { var window = parameter as Window; if (window != null) { window.WindowState = WindowState.Minimized; } } } }