Пример #1
0
 private void BtnClose_Click(object sender, RoutedEventArgs e)
 {
     if (sender != null && Window.GetWindow(sender as WindowControlButton) is Window window)
     {
         window.Close();
     }
 }
Пример #2
0
 private void BtnMinimize_Click(object sender, RoutedEventArgs e)
 {
     if (sender != null && Window.GetWindow(sender as WindowControlButton) is Window window)
     {
         window.WindowState = WindowState.Minimized;
     }
 }
Пример #3
0
        private void BtnMaximize_OnClick(object sender, RoutedEventArgs e)
        {
            if (sender == null || !(Window.GetWindow(sender as WindowControlButton) is Window window))
            {
                return;
            }

            switch (window.WindowState)
            {
            case WindowState.Maximized:
                window.WindowState = WindowState.Normal;
                break;

            case WindowState.Normal:
                window.WindowState = WindowState.Maximized;
                break;
            }
        }