Example #1
0
 static void window_StateChanged(object sender, System.EventArgs e)
 {
     if (sender is Window w)
     {
         if (w.WindowState == WindowState.Maximized)
         {
             WindowMaximized.SetIsNotMaximized(w, false);
         }
         else
         {
             WindowMaximized.SetIsNotMaximized(w, true);
         }
     }
 }
Example #2
0
        private static void IsNotMaximizedChanged(DependencyObject d,
                                                  DependencyPropertyChangedEventArgs e)
        {
            var window = d as Window;

            if (window != null)
            {
                window.StateChanged -= window_StateChanged;
            }

            if (window != null)
            {
                window.StateChanged += window_StateChanged;

                if (window.WindowState == WindowState.Maximized)
                {
                    WindowMaximized.SetIsNotMaximized(window, false);
                }
                else
                {
                    WindowMaximized.SetIsNotMaximized(window, true);
                }
            }
        }