views:

311

answers:

1

Hi,

I just want to find out how to run two WPF windows (one in extended desktop) while in Full screen mode.

+3  A: 

Add System.Windows.Forms.dll and System.Drawing.dll references and try this:

public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);

        foreach (var screen in System.Windows.Forms.Screen.AllScreens)
        {
            var window = new Window1
            {
                WindowStartupLocation = WindowStartupLocation.Manual,
                WindowState = WindowState.Maximized,
                WindowStyle = WindowStyle.None,
                Title = screen.DeviceName,
                Width = screen.Bounds.Width,
                Height = screen.Bounds.Height,
                Left = screen.Bounds.Left,
                Top = screen.Bounds.Top,
            };
            window.Show();
        }
    }
}

Don't forget to remove StartupUri="Window1.xaml" from App.xaml.

Sergey Galich
How am I suppose to run Window1.xaml now?
eibhrum
var window = new Window1...;window.Show(); // <-- this call replaces StartupUri="Window1.xaml"
Sergey Galich