Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How can I load a WPF in a specific screen point? I tried next code and I searched about other resources like the WorkingArea or WindowStartupLocation but I could not do it.

XML
private void Application_Startup(object sender, StartupEventArgs e)
        {
                     base.OnStartup(e);
MainWindow m = new MainWindow();
Point point = m.PointToScreen(
                            new Point(320, 120));double dpiX =
               96.0 * source.CompositionTarget.TransformToDevice.M11;
           double dpiY =
               96.0 * source.CompositionTarget.TransformToDevice.M22;

           m.Left = point.X * 96.0 / dpiX; ;
           m.Top = point.Y * 96.0 / dpiX; ;*/&lt;/pre&gt;</pre>
   m.Show();
}

The goal is to load different WPF apps and fill the screen with them. Is there a better way to do this?
Help please :)
Posted

1 solution

Here: https://msdn.microsoft.com/en-us/library/system.windows.window.windowstartuplocation%28v=vs.110%29.aspx[^].

What you are doing makes little sense. If you want several applications to self-arrange their main windows on the screen, you first need to inquire the screen size. Also, you need to take care of sizes as well. Finally, your applications don't "know" about each other; is that reasonable? Do you want to have that predefined window location independent from other ones? Maybe, if you arrange some fixed set of applications, it would be better to integrate them all in one?

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900