Take the 2-minute tour ×

I have one main window in my wpf application, and when clicking on a button a new window is opening. Now, when i'm using 2 monitors as extended display - when i'm running my app on my primary screen and clicks the button to open the second window, it's appearing in the same screen and that's ok. BUT, when i'm dragging the main window to the secondary screen and then clicks the button, the second window still opens in the primary screen and NOT what I want.

I want the second window to open always in the screen that the main window does.

How can I do it from code?

share|improve this question

1 Answer 1

You can use WindowStartupLocation property. Set it to CenterScreen or CenterOwner. For CenterOwner to work, on second screen you need to set the Owner property to be your first window.

If you need to fine-tune your positioning, you can use Screen object (from System.Windows.Forms namespace/assembly).

share|improve this answer

Your Answer


