-1

I have this device physical characteristics:

Display:

  • 8.4 in.: 21.3 cm; 720 nits
  • 10.1 in.: 25.7 cm; 540 nits
  • Supports up to 2560x1600;
  • Corning Gorilla Glass; daylight viewable

Dimensions:

  • 8.4 in. tablet: 9 in. W x 5.9 in. H x 0.5 in. D/
  • 228 mm W x 150 mm H x 12.7 mm D
  • 10.1 in. tablet: 10.6 in. W x 7.1 in. H x 0.5 in. D/
  • 269 mm W x 181 mm H x 12.7 mm D

Physical Characteristics

I want to set MinHeight and MinWidth, that should be the actual height and width of the screen of this device.

What's the corect MinHeight and MinWidth? I don't know how to calculate it

Martin Liversage
  • 104,481
  • 22
  • 209
  • 256
lgica
  • 21
  • 1
  • 6

2 Answers2

0

To determine the WPF width and height of the display requires knowledge of the DPI of the display. One thing is the actual DPI and another is the DPI that WPF believes the display has.

Taking the 8.4 tablet as an example:

Unit Width Height
mm 228 150
inch ~8.98 ~5.91
pixels 2560 1600
DPI ~285 ~271

You convert mm to inch by dividing by 25.4. You get DPI by dividing the pixels with the inches.

Most likely the pixels are square so the horizontal and vertical DPI are the same. Probably the height in mm is greater than the actual display which means that it includes a bezel. And so the same is probably true for the width.

So a guess is that the "logical" DPI of the display is 288. This happens to be three times 96 and WPF units are 1/96 inch.

If this is true you have to divide the actual pixels (2560 and 1600) by 3 to determine the WPF units to use:

MinWidth = 2560/3;
MinHeight = 1600/3;

However, as you can see there is some guessing involved in this. What if WPF sees the display as having 96 DPI and not 288 DPI? Then you should not divide by 3 but instead by 1 which is the same as not dividing. The best way to figure this out is to actually use WPF with the display.

Martin Liversage
  • 104,481
  • 22
  • 209
  • 256
0

You could go through all the trouble of getting the screen height in physical pixels, converting to WPF's "device-independent pixels" unit, accounting for Taskbar size and placement, accounting for reserved space at the borders of the screen, etc.

You could do all that, or you could just use the very simple method from this answer:

Just set the WindowState to Maximized, and the WindowStyle to None.

This totally fills the entire screen, but leaves all the above details to Windows to figure out.

Keith Stein
  • 6,235
  • 4
  • 17
  • 36