12345678910111213141516171819202122232425262728293031323334353637383940 |
- 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 WindowMaximizeCommand :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)
- {
- if(window.WindowState == WindowState.Maximized)
- {
- window.WindowState = WindowState.Normal;
- }
- else
- {
- window.WindowState = WindowState.Maximized;
- }
- }
- }
- }
- }
|