Search This Blog

Showing posts with label Forms. Show all posts
Showing posts with label Forms. Show all posts

Tuesday, August 22, 2017

Display XAML window in the second display WPF

WPF > Windows > Forms > Screen

AllScreens gets an array of all displays on the system.

Example

Display window in the second display WPF

private void Window_Loaded(object sender, RoutedEventArgs e)
{
   var screen = System.Windows.Forms.Screen.AllScreens.Where(s => !s.Primary).First();
   var area = screen.WorkingArea;
   Left = area.Left;
   Top = area.Top;
   Width = area.Width;
   Height = area.Height;
}