To simplify things, consider the following MainWindow class inheriting fromSystem.Windows.Window:
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
namespace WpfApp1
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
StateChanged += MainWindow_StateChanged;
MouseUp += MainWindow_MouseUp;
}
private void MainWindow_StateChanged(object sender, EventArgs e)
{
if (WindowState == WindowState.Maximized)
{
Debug.WriteLine("Window Maximized");
}
}
private void MainWindow_MouseUp(object sender, MouseButtonEventArgs e)
{
Debug.WriteLine("Window MouseUp");
}
}
}
When this window is in normal state if I double click its title bar then it is maximized and a Window.MouseUp event is raised, which results in the following output in VS Output pane:
Window Maximized Window MouseUp