0
votes

I have a WPF application that fits into my computer screen having screen resolution 1920 * 1080. But the same WPF application doesn't fit into my Microsoft Surface screen having same resolution 1920 * 1080. The exact issue is, it doesn't show the scroll bar in that little laptop. The issue is in the XAML for the page I am having trouble with and the window that hosts it. Any suggestion would be appreciated. Thanks.

The code is something like this right now.

  <Page x:Class="form_Dock" Background="#FF19191E"  MouseEnter="Page_MouseEnter" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:ABC.UI" SnapsToDevicePixels="True">
1

1 Answers

0
votes

This could be a scaling issue caused by WPF using device independent pixels to determine the size of the application. The Surface screen is pretty small, so there may be some scaling done in Windows to compensate, which is throwing the size of your window out.

You might be able to fix your problem by setting SnapsToDevicePixels on the window element to true:

https://msdn.microsoft.com/en-us/library/system.windows.uielement.snapstodevicepixels(v=vs.110).aspx

Also, this explains device independent pixels quite well:

https://wpf.2000things.com/2013/02/19/759-device-independent-units-dips/