Bug 59404 - WindowsDeviceInfo ScalingFactor property missing implementation for multiple ResolutionScale enums
Summary: WindowsDeviceInfo ScalingFactor property missing implementation for multiple ...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.4.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Paul DiPietro [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-09-12 00:40 UTC by kellymnoe23
Modified: 2017-12-21 23:30 UTC (History)
4 users (show)

Tags: ac fr
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description kellymnoe23 2017-09-12 00:40:09 UTC
**Issue: 

The Xamarin.Forms.Platform.UWP.WindowsDeviceInfo class ScalingFactor property implementation is missing several ResolutionScale enums, which results in Xamarin.Forms.Device.Info.ScalingFactor incorrectly returning the default value of '1' for several ResolutionScales.

https://docs.microsoft.com/en-us/uwp/api/windows.graphics.display.resolutionscale

For our scenario, we are specifically missing Scale125Percent.

**Steps to reproduce:

1. In a Xamarin.Forms app, add an implementation to the portable project to display the value of Xamarin.Forms.Device.Info.ScalingFactor on the app main page 
2. Add a UWP-specific implementation to print the value of the DisplayInformation.ResolutionScale to the app main page
3. Deploy the UWP implementation of the app to a Win10 system with a resolution that results in Scale125Percent (in our case Dell Latitude 5175, resolution of 1920 x 1080)
4. Start the app
5. Observe that the displayed ResolutionScale is Scale125Percent, however the ScalingFactor is 1 (expected 1.25)

**Comments
Would it be possible to just return Windows.Graphics.Display.DisplayInformation.RawPixelsPerViewPixel property instead of relying on the switch statement?

**Switch statement code from Xamarin.Forms.Platform.UWP.WindowsDeviceInfo
switch (scale)
{ 
  case ResolutionScale.Scale120Percent:
    return 1.2;
  case ResolutionScale.Scale140Percent:
    return 1.4;
  case ResolutionScale.Scale150Percent:
    return 1.5;
  case ResolutionScale.Scale160Percent:
    return 1.6;
  case ResolutionScale.Scale180Percent:
    return 1.8;
  case ResolutionScale.Scale225Percent:
    return 2.25;
  case ResolutionScale.Scale100Percent:
    default:
  return 1;
}
Comment 1 Paul DiPietro [MSFT] 2017-09-13 19:34:59 UTC
Windows.Graphics.Display.DisplayInformation.RawPixelsPerViewPixel is only available on UWP so we would have to check for that as WinRT is not fully removed yet.
Comment 2 Samantha Houts [MSFT] 2017-09-20 18:08:39 UTC
https://github.com/xamarin/Xamarin.Forms/pull/1142
Comment 3 Rui Marinho 2017-12-21 23:30:13 UTC
Should be fixed on 2.6.0-pre1