Bug 53301 - OnIdiom implementation is not correct for UWP
Summary: OnIdiom implementation is not correct for UWP
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.4
Hardware: PC Windows
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-03-14 08:58 UTC by Glenn Versweyveld
Modified: 2017-06-22 01:16 UTC (History)
3 users (show)

Tags: onidiom continuum desktop phone ac uwp
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 for Bug 53301 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Glenn Versweyveld 2017-03-14 08:58:08 UTC
Current DetectPlatform code for UWP, will report Windows Phone if there are hardware buttons available : https://github.com/xamarin/Xamarin.Forms/blob/e6d5186c8acbf37b877c7ca3c77a378352a3743d/Xamarin.Forms.Platform.WinRT.Tablet/Forms.cs#L49

But this is not correct to be used in an OnIdiom scenario... a windows phone running in continuum mode will still report Phone as detected platform although we want to relayout out app to the OnIdiom.Desktop scenario.

Also the OnIdiom.Tablet enumeration will never be hit in an UWP scenario with the current DetectPlatform code ( the Default: case in the switch statement is never hit ).

We need to rely on screen size to determine the correct OnIdiom environment for UWP - which is maybe not possible with the current setup of Xamarin forms.

Also there is no guaranty that a vendor will not release a smaller non phone device, where we would actually want OnIdiom.Phone even though we will be getting OnIdiom.Desktop with the current implementation.
Comment 1 Paul DiPietro [MSFT] 2017-03-14 18:54:20 UTC
This is a fair point and I think we'll have to look into this further. I'm updating the issue status for purposes of acknowledgement, and that it will need to be discussed to see how we'd like to move forward.
Comment 2 Glenn Versweyveld 2017-03-14 22:54:09 UTC
Fair enough!
I mostly like the reference we have in UWP and also in Web development.

UWP has visual states that uses screen sizes to change the layout.
Web development has media queries.

Would be nice if Xamarin forms had something similar, so that the design will adapt depending on the size instead of relying on the current detect platform method.