Mar 10 2020 11:21 AM - edited Mar 10 2020 11:25 AM
Idea
The large screens of the Duo are able to present more information than any other "single" screen Android device.
That's why I need to know if the app is running on a Surface Duo or not. In my optionen, please correct me if this feature already exists, a simple member provided by the SDK that indicatates if it is running on a Duo would be great.
Example extension
public static class DualScreenInfoExtensions
{
public static bool IsDuo(this DualScreenInfo dualScreenInfo)
{
return DualScreenInfo.Current.HingeBounds.Width != 0;
}
}
Example usage
For example to show a multi column layout for "is a Duo" and a single column layout for "is not a Duo"
if(DualScreenInfo.Current.IsDuo())
{
SecondColumnWidth = new GridLength(1, GridUnitType.Star);
}
else
{
SecondColumnWidth = new GridLength(0, GridUnitType.Absolute);
}
**GitHub**
I also created an issue in the Xamarin Surface Duo samples repository.
Apr 14 2020 09:47 AM
Hey @tscholze, I also posted on the samples issue, but I recommend this request go on the Xamarin.Forms open-source repo, as it will be most visible to the team.