title: Get correct device width in Xamarin forms
body: <p>I'm using <a href="https://github.com/XLabs/Xamarin-Forms-Labs" rel="nofollow noreferrer">Xamarin labs in my Xamarin Forms</a> project and it has a class that you can use to request information about the running device the app is on.</p>
  
  <p>In my case I want to know the current Width of the Device screen.
  To get this you need to wire up the <code>IDisplay</code> interface in the iOS appdelegate so that you can use that in your forms code.</p>
  
  <p>So in my forms code I get the width by requesting <code>Resolver.Resolve&lt;IDevice&gt;.Display.Width</code> or <code>Resolver.Resolve&lt;IDevice&gt;.Display.XDpi</code></p>
  
  <p>Now when running this on a iPhone 6 simulator I'm getting 750 for width and 326 for XDpi.
  What I'm now trying to do is use one of these 2 values to size images on the screen, so that they will have the exact width of the screen.</p>
  
  <pre><code>var image = new Image (){ Source = "img1.jpg", WidthRequest = _display.Width });
  </code></pre>
  
  <p>I'm displaying them inside a <code>ExtendedScrollView</code></p>
  
  <pre><code>&lt;StackLayout&gt;
      &lt;controlsXLabs:ExtendedScrollView x:Name="ImageScrollView"
                                        Orientation="Horizontal"
                                        AnimateScroll="true"
                                        Scrolled="OnScrolled"&gt;
          &lt;StackLayout x:Name="DiscoverImagesStackLayout" Orientation="Horizontal" /&gt;
      &lt;/controlsXLabs:ExtendedScrollView&gt;
      &lt;Button Text="Click me" Clicked="OnButtonClicked" /&gt;
  &lt;/StackLayout&gt;
  </code></pre>
  
  <p>But the problem I'm facing now is that using Width ( 750 ) is to big ( retina scaling? ) and using XDpi is to small!</p>
  
  <p>In other words how do I get the actual screen width that I can use to match with the width of my images?
  Or am I doing something wrong?</p>
  
  <p>Added screenshots, first one is to big, second to small ( in reference to the screen size )</p>
  
  <p><a href="https://i.stack.imgur.com/o6pJU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o6pJU.png" alt="Display.Width ( to big )"></a></p>
  
  <p><a href="https://i.stack.imgur.com/5rEHC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5rEHC.png" alt="Display.XDpi ( to small )"></a></p>