Hi @Brandon Boone ,
You can get current use below code:
WindowInteropHelper windowInteropHelper = new WindowInteropHelper(this);
Screen currentScreen = Screen.FromHandle(windowInteropHelper.Handle);
I made a sample:
CS Code:
using System;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Interop;
namespace WpfApp.Netframework
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var doc = txtScreenInfo.Document;
doc.Blocks.Clear();
WindowInteropHelper windowInteropHelper = new WindowInteropHelper(this);
Screen currentScreen = Screen.FromHandle(windowInteropHelper.Handle);
txtScreenInfo.AppendText("Current Scrren Name: " + currentScreen.DeviceName);
txtScreenInfo.AppendText(Environment.NewLine);
foreach (var item in Screen.AllScreens)
{
txtScreenInfo.AppendText("Device Name: " + item.DeviceName);
txtScreenInfo.AppendText(Environment.NewLine);
txtScreenInfo.AppendText("Bounds: " + item.Bounds.ToString());
txtScreenInfo.AppendText(Environment.NewLine);
txtScreenInfo.AppendText("Type: " + item.GetType().ToString());
txtScreenInfo.AppendText(Environment.NewLine);
txtScreenInfo.AppendText("Working Area: " + item.WorkingArea.ToString());
txtScreenInfo.AppendText(Environment.NewLine);
txtScreenInfo.AppendText("Primary Screen: " + item.Primary.ToString());
txtScreenInfo.AppendText(Environment.NewLine);
txtScreenInfo.AppendText("=====================================================");
txtScreenInfo.AppendText(Environment.NewLine);
}
txtScreenInfo.ScrollToEnd();
}
}
}
XAML Code:
<Window x:Class="WpfApp.Netframework.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp.Netframework"
mc:Ignorable="d"
Title="MainWindow" Height="800" Width="800">
<Grid Height="800">
<Grid.RowDefinitions>
<RowDefinition Height="700"></RowDefinition>
<RowDefinition Height="100"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Content="Get" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="650,0,10,10" Click="Button_Click" Height="30" Width="60"/>
<RichTextBox Grid.Column="0" Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="txtScreenInfo" Height="700" Width="780">
<FlowDocument>
<Paragraph>
<Run/>
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
</Window>
Run result:
DISPLAY 1:
DISPLAY 2:
If right, please Accept.
Enjoy programming!!!