My Windows settings are set to have a DPI of 96. However when I create the following Window
it will be a little smaller then my screen (which is set to the resolution 1920*1080):
<Window x:Class="WPF_Sandbox.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPF_Sandbox"
mc:Ignorable="d"
Title="MainWindow"
Width="1920">
</Window>
According to this msdn blog post:
1 device independent pixel = 1/96 inch.
1 physical pixel = 1/DPI (dependent on the system DPI)Default system settings usually choose a DPI of 96 so these two types of pixels come out to be the same size.
However this does not seem to be the case since my Window
is clearly less then 1920 pixel wide.
If I maximize the Window
and inspect its ActualWidth
it appears to be 1936
.
Why is this the case?