在最小化之前如何知道System.Windows.Window是处于WindowState.Normal还是WindowState.Maximized?
答案 0 :(得分:0)
除非您自己跟踪以前的状态,否则您不会这样做:
private WindowState _previousState = WindowState.Normal;
private void MainWindow_StateChanged(object sender, EventArgs e)
{
if (WindowState == WindowState.Minimized)
{
if (_previousState == WindowState.Maximized)
{
MessageBox.Show("Window was in maximized state before being minimized");
}
else
{
MessageBox.Show("Window was in normal state before being minimized");
}
}
_previousState = WindowState;
}
恐怕没有可用的“ PreviousWindowState”属性。