Beispiel #1
0
 private void BtnClose_Click(object sender, RoutedEventArgs e)
 {
     if (sender != null && Window.GetWindow(sender as WindowControlButton) is Window window)
     {
         window.Close();
     }
 }
Beispiel #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;
     }
 }
Beispiel #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;
            }
        }