I'm trying to create a WPF window that will encompass the entire Desktop working area. In WinForms I'd do this by getting the Union of all the bounds in System.Windows.Forms.Screen.AllScreens
.
Is there an equivalent type or other mechanism to get the bounds of the entire desktop in WPF or do I need to use the WinForms type?
Windows forms are mainly based on a pixel, whereas WPF is not pixel-based, which allows the scalability of the UI part for the application. Windows forms support data binding in a limited way, whereas WPF is fully supported data binding. Windows forms are not used with different themes or skins.
Universal Windows Platform. Both Windows Forms and WPF are old, and Microsoft is pointing developers towards its Universal Windows Platform (UWP) instead. UWP is an evolution of the new application platform introduced in Windows 8 in 2012.
Add a WPF control to a Windows Form Your new WPF control is ready for use on the form. Windows Forms uses the ElementHost control to host WPF content. To add a WPF control to a Windows Form: Open Form1 in the Windows Forms Designer.
WPF, would be your answer to Windows Forms if you are on the . NET platform.
Try SystemParameters.VirtualScreen* (Top, Left, Height, and Width) properties. http://msdn.microsoft.com/en-us/library/system.windows.systemparameters.virtualscreenheight(v=VS.100).aspx
Don't use winforms api because it doesn't take into account the fact that WPF's measurement units are not pixels. I came across this issue just recently because I'm losing my vision and have my monitor set to a higher dpi. The codebase I was working on used the Winforms Settings and the UI was larger than my screen.
If you're going to use the winforms api. Look at this blog post on calculating the DPI factor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With