One of the features of a WPF application is that it is resolution independent. Now what does resolution independence of WPF Application really mean ?

Our monitor screen depends upon two factor to display the text and graphics , first is resolution and other is DPI (Dot Per Inch) .

Resolution:

Number of pixels that appears on the screen is dependent upon the resolution set in the system. When we increase resolution ,pixels will decrease in turn text and graphics will be small. The pixel density can be calculated as –

dp = Sqrt[ sqr(wp) + sqr(hp)]

PPI is referred as DPI which can be calculated as

PPI = dp / di

where

dp is diagonal resolution in pixels,

wp is width resolution in pixels,

hp is height resolution in pixels and

di is diagonal size in inches.

Sqrt is square root

sqr is square in mathematical term

DPI:

DPI is the other factor which describes screen inches in pixels . When we increase the DPI setting,it makes the screen inch larger; decreasing the DPI makes the screen inch smaller. When we increase DPI we make the screen inch larger so the text and graphics gets increased in size in higher DPI setting.

To understand the resolution independence we need to understand another term called Device Independent Unit(DIU).Device independent unit in WPF is the measurement of unit in terms of inches rather than pixel. It is 1/96 of an inch . The way WPF uses this calculation is :

[Physical Pixel] = [Device independent unit] * [System DPI]

When resolution changes :

So for a LCD screen with resolution 1600 * 1200 pixel with 19 inch screen , if we calculate the pixel density

[Screen DPI] = Sqrt[ sqr(1600) + sqr(1200)] / 19

= 100 DPI

And for Laptop screen with resolution 1024 * 768 pixels with 15 inch screen, if we calculate the pixel density

[Screen DPI] = Sqrt[ sqr(1024) + sqr(768)] / 15

= 85 DPI

where Sqrt is Square root and sqr is square in mathematical term.

When DPI changes :

Lets calculate the physical pixel in case of monitor with 96 system DPI

[Physical Pixel] = [Device independent unit] * [System DPI]

= (1 / 96 inch) * ( 96 DPI)

= 1 Pixels

So for the button with 96 pixel width will actually be (96 * 1) = 96 pixel and

Again when we will change the DPI to 120 DPI

[Physical Pixel] = [Device independent unit] * [System DPI]

= (1 / 96 inch) * ( 120 DPI)

= 1.25 Pixels

For the button with 100 pixel width will actually be (96 * 1.25) = 120 pixel. So in higher pixel density or standard pixel density ,display of button will be almost same.

So here we can conclude that WPF application are not dependent upon DPI setting of the system which makes them more resolution independent.

Mukesh Nayak , Dot Net Developer, Mindfire Solutions.