From my experience, Window.RestoreBounds
will always give you the final "normal" dimensions of your window, and Window.WindowState
will always give you the final state of the window (max, min, normal). No matter what state you're in, you can always just save off RestoreBounds and WindowState and manually set the window dimensions/state.
This is how I've done it (and I know the restore isn't pure but I don't really care):
private class WindowStatus
{
private WindowState state;
private Rect restoreBounds;
public WindowStatus(Window window)
{
state = window.WindowState;
restoreBounds = window.RestoreBounds;
}
public void Restore(Window window)
{
window.WindowState = state;
window.Height = restoreBounds.Height;
window.Width = restoreBounds.Width;
window.Left = restoreBounds.Left;
window.Top = restoreBounds.Top;
}
}