Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

[WPF][C#] Window not maximized when running on Administrator?

$
0
0

I have WPF application with a child window (Test) and it should be run on Administrator mode. So run your Visual Studio as administrator. And the child window will be triggered using the below code.

Test win = new Test();
win.Owner = this;
win.ShowDialog();

When minimizing the child window, the parent window is not minimized and also the child window was not minimized completely because I have used ShowInTaskbar as false for child window. Hence I have used the below code in child window.

protected override void OnStateChanged(EventArgs e)
{
   base.OnStateChanged(e);
   if (this.Owner != null && this.WindowState == WindowState.Minimized)
   {
       this.Owner.WindowState = WindowState.Minimized;
   }
}

Now the parent window is minimized, but not able to restore the application using Taskbar or Alt+Tab. But it works fine when running Visual Studio without administrator mode. Any solutions to overcome this?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>