Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a dialog(view) open up on the same monitor as the main window

In a PC with multiple monitors, say you run your application which have have a second Window/Dialog other than the main window (such as Options) that you want it to open in the same screen/monitor as your MainWindow. How to force this behavior?

You basically want to stop the scenario that your MainWindow is on one monitor and when you bring up the "Options" page, it shows on a different screen/monitor.

like image 861
Mehrad Avatar asked Mar 13 '15 01:03

Mehrad


People also ask

How do you make a window pop up on a certain screen?

1] Move apps to the desired monitor To do so, open the app on your computer first. Then, drag or move it to the desired monitor you want to open it on. Following that, close the app by clicking the Close or red cross button. After that, it will open on the last opened monitor all the time.

How do you change which screen notifications appear on Windows 10?

Action Center in Windows 10 is where you'll find your notifications and quick actions. Change your settings at any time to adjust how and when you see notifications and which apps and settings are your top quick actions. Select Start . Select Settings > System > Notifications & actions.

How do I stop programs from opening on my second monitor?

Click Start, point to Programs, click Control Panel, and then double- click Display. Click the Settings tab. In the Display box, click the secondary display adapter. Click the "Extend my Windows desktop onto this monitor" check box to clear it, and then click OK.


1 Answers

Have you looked at the WindowStartupLocation property for Window?

CenterScreen places the Window in the center of the screen containing the cursor, which should normally be fine. For example, if a user clicks a button on your Window and a dialog opens, the cursor will still be over the button and thus the dialog will show up in the center of the same Window.

CenterOwner places the Dialog in the center of the Window specified as it's owner. Declare the new Window similar to this:

MyDialog d = new MyDialog { Owner = parentWindow };
d.ShowDialog();
like image 115
learningcs Avatar answered Sep 21 '22 14:09

learningcs