5

How can I make a WPF window (And its controls) have the same size, in pixels, regardless of the system DPI/scale?

My application determines its width and height based on the screen size, and will scale the content area automatically. I'd the controls to appear to all be at the standard "Smaller (100%)" scale. enter image description here

Currently my application will scale up when on "Medium" or "Larger". I understand this is how WPF is designed to work, but I want to force it to not scale at higher scales. Changing the "DPI Aware" property in the application will have no affect on the size of it, just whether or not it is scaled properly vs being blurry due to being stretched.

If I have a small laptop screen with the default (100%) scale, and a desktop with a 1080p display at 125%, I want the controls to be the same size, pixel wise. This will make the application smaller on the 1080p screen, but my application will increase it's size to make it appear bigger. (The controls will be the same size in pixels, but the main area of my application, a canvas that can be drawn on, will be larger)

Cyral
  • 13,999
  • 6
  • 50
  • 90

0 Answers0