Search code examples
c#.netwpfwindows

Window is not restored after minimized


WPF window can't be restored from the taskbar or using Alt+Tab after being minimized (it stays minimized). It happens on a part of environments (on my machine it's Ok but fails on some others).

I can switch to the window from Task manager - then it gets restored.

As a hotfix I added:

void Window_Activated(object sender, EventArgs e)
{
   ...
   if (this.WindowState == WindowState.Minimized)
   {
      this.WindowState = WindowState.Normal;
   }
}

It helped. But I don't think that is the best solution. Have you any other ideas to fix it?


Solution

  • Seems the best existing solution so far is the one I found:

    void Window_Activated(object sender, EventArgs e)
    {
       ...
       if (this.WindowState == WindowState.Minimized)
       {
          this.WindowState = WindowState.Normal;
       }
    }