WindowStartupLocation.CenterScreen is opening my window on the wrong display

Posted by chaiguy on Stack Overflow See other posts from Stack Overflow or by chaiguy
Published on 2010-04-20T18:04:51Z Indexed on 2010/04/20 18:33 UTC
Read the original article Hit count: 294

Filed under:
|
|

According to the documentation, CenterScreen should open the window in the center of the screen that contains the mouse cursor, however this is not happening. I have a dual monitor setup, with my secondary monitor appearing to the left of my primary monitor (the one with the task bar).

When the user clicks a link in my interface on the primary (right-most) monitor, and I open a new window with WindowStartupLocation set to CenterScreen, the window appears in the center of the screen of the left monitor. This is not where the mouse is and I am lost as to why it is picking that display.

Has anyone experienced this before or have any ideas for a workaround?

If I can't get the proper behavior using WindowStartupLocation, I will just manually move the window to the proper display (I still have to figure that out though).

© Stack Overflow or respective owner

Related posts about wpf

Related posts about .NET