Alex
Alex

Reputation: 31

WPF Window Position

How I can set the position of the windows in the center of the screen in my XAML?

Thank you.

Upvotes: 3

Views: 1030

Answers (2)

Zamboni
Zamboni

Reputation: 8043

I agree with Otávio.
Also if you create a child window you can use:

WindowStartupLocation="CenterOwner" 

But you need to remember to set the Owner property of the child window to the parent window or the child window does not center properly.

Upvotes: 2

Otávio Décio
Otávio Décio

Reputation: 74250

Put this in your Window declaration in your XAML:

WindowStartupLocation="CenterScreen"

Upvotes: 2

Related Questions