.NET Framework Developer Center >
.NET Development Forums
>
Windows Presentation Foundation (WPF)
>
Correlation between DPI and dialog units
Correlation between DPI and dialog units
- Hi all,
I'm working on the UI for my app, and am trying to use the Vista UI Guidelines. On this page:
Layout
They're always talking about DLU's. What's the difference between DPI (which WPF uses) and DLU, and how do I switch between the two?
Thanks,
Frances
Answers
- Hi Frances

Dialog units change in size based on the system font.
1 dialog unit of width = 1/4 the average width of the system font
1 dialog unit of height = 1/8 the average height of the system font
For more information see: http://support.microsoft.com/kb/145994/en-us
The layout page you linked to above also has a column for pixels, which from what I can see, seems to mean device-independent pixels. This is the unit WPF uses to specify lengths and sizes and is equal to 1/96th of an inch. So you can probably use those values directly in your Xaml. Can anyone from Microsoft confirm if this was the intention?
All Replies
DPI is relates to the current resolution of the screen and how the system is scaling fonts. It used to be that WIN32 applications needed to be developed and made DPI aware, but this is one of the features that WPF handles for you, automatic DPI scaling.
DLU describes spacing and sizing guidelines which is based on the current size of the font used in your application, which is effected by DPI.
- Hmmm... So is there a way for me to calculate the number of DPI from the DLU, or should I just make an educated guess?
- Hi Frances

Dialog units change in size based on the system font.
1 dialog unit of width = 1/4 the average width of the system font
1 dialog unit of height = 1/8 the average height of the system font
For more information see: http://support.microsoft.com/kb/145994/en-us
The layout page you linked to above also has a column for pixels, which from what I can see, seems to mean device-independent pixels. This is the unit WPF uses to specify lengths and sizes and is equal to 1/96th of an inch. So you can probably use those values directly in your Xaml. Can anyone from Microsoft confirm if this was the intention? - Hi Jacob,
fancy 'seeing' you here
Hmmm, using the pixels... I'll give that a swing. - I've tried the pixels, but I think this is not exaxctly what is needed. AS far as I can see, the distances are too small.
Can someone from Microsoft please tell if I'm doind the right thing here?


