WPF boasts of one of its substantial feature called resolution independence. But it is really subtle to understand it in the way it is provided by WPF.
Does WPF really provide resolution independence? or Microsoft lies about it? To know it exactly you need to go deeper into it. For instance if you create a wpf application and run it and then change the resolution of your machine. What would you expect? Your wpf application window should remain of the same size, isn't it? But that does not happen actually. Your window size will change as you change the resolution. OK let's try something else. You change the dpi settings of your screen and observe the window size. Again you will see the difference. So what is resolution independence in wpf then?
I will not keep puzzling you more. I explained these scenario so that you have an initial understanding of it. The wpf resolution independence feature says that the dimensions are measured in inches in wpf not in pixels and the logical unit in wpf is 1/96 of an inch. This scale may be chosen because most of the desktops usase resolution of 96 dpi, where dpi is Dots Per Inch.
So when you change the resolution or dpi setting of your screen, say for example, your device display is based on 96 dpi and you change it to 100 dpi, wpf will now calculate the dimensions of its UI elements based on 100 dpi but the device display supports only 96 dpi and so the window size of your wpf application will decrease. If you decrease the resolution of the screen to less than 96 dpi, your window size will increase.
Now, take a device that has a base resolution of 112 dpi and another device that has a base resolution of 72 dpi and run the wpf application on both the devices without changing the resolution. You will see that the window size is same on both the screens.
These all three instances explains that wpf does not go for the physical dpi setting of the device but sees only what is set for the operating system and according calculates the ratio of its measurement scale and the device dpi setting to show the exact dimensions of its UI elements in inches.
Concludingly, we can say that wpf supports resolution independence such that it will show the same dimensions of its UI elements for different devices that have different resolutions provided that the resolution setting are the same as the device's base resolution.
If you want to read this concept in more detail, you can read the detailed article
Is WPF Really Resolution Independent? by Cal.
Does WPF really provide resolution independence? or Microsoft lies about it? To know it exactly you need to go deeper into it. For instance if you create a wpf application and run it and then change the resolution of your machine. What would you expect? Your wpf application window should remain of the same size, isn't it? But that does not happen actually. Your window size will change as you change the resolution. OK let's try something else. You change the dpi settings of your screen and observe the window size. Again you will see the difference. So what is resolution independence in wpf then?
I will not keep puzzling you more. I explained these scenario so that you have an initial understanding of it. The wpf resolution independence feature says that the dimensions are measured in inches in wpf not in pixels and the logical unit in wpf is 1/96 of an inch. This scale may be chosen because most of the desktops usase resolution of 96 dpi, where dpi is Dots Per Inch.
So when you change the resolution or dpi setting of your screen, say for example, your device display is based on 96 dpi and you change it to 100 dpi, wpf will now calculate the dimensions of its UI elements based on 100 dpi but the device display supports only 96 dpi and so the window size of your wpf application will decrease. If you decrease the resolution of the screen to less than 96 dpi, your window size will increase.
Now, take a device that has a base resolution of 112 dpi and another device that has a base resolution of 72 dpi and run the wpf application on both the devices without changing the resolution. You will see that the window size is same on both the screens.
These all three instances explains that wpf does not go for the physical dpi setting of the device but sees only what is set for the operating system and according calculates the ratio of its measurement scale and the device dpi setting to show the exact dimensions of its UI elements in inches.
Concludingly, we can say that wpf supports resolution independence such that it will show the same dimensions of its UI elements for different devices that have different resolutions provided that the resolution setting are the same as the device's base resolution.
If you want to read this concept in more detail, you can read the detailed article
Is WPF Really Resolution Independent? by Cal.
No comments:
Post a Comment