Master_T
Master_T

Reputation: 7913

WPF: open a window in maximized state from the start

I want to open a window in WPF that is already maximized as soon as it is visible.

I tried the obvious:

<Window Title="My window" WindowState="Maximized" ...>
    ...
</Window>

however, if I do this the window doesn't open maximized. It opens at its default size and then, half a second later, gets maximized. Is there a way to bypass this and open the window maximized from the start?

EDIT: not a duplicate of the linked question, I'm doing it the same way as the accepted answer there. My problem isn't that it doesn't work, the problem is that it doesn't work "fast enough": with that solution the window opens not maximized and then gets maximized a split second later. I want to know if there's a way to open it ALREADY maximized.

Upvotes: 0

Views: 300

Answers (1)

Explorer2501
Explorer2501

Reputation: 74

How you open the window ?

Try this.

win1 = new Window1();
win1.Show();
win1.WindowState = WindowState.Maximized;

Upvotes: 2

Related Questions