George M Ceaser Jr
George M Ceaser Jr

Reputation: 1769

Detect Windows Phone 8.1 versus UWPapp on Windows Phone in Xamarin Forms

I am trying to find a way to distinguish if my app is running as UWP app on a phone or if it Both WinPhone 8.1 and UWP app on a phone have a Device.OS of TargetPlatform.Windows. Thus I cannot find a way to determine if it is a UWP app or Windows Phone 8.1 app running in a phone. Any suggestions? My sample code is below.

        if ( Device.OS == TargetPlatform.Windows)
        {
            this.grdButtons.ColumnSpacing = 0;
        }

Upvotes: 2

Views: 449

Answers (1)

Lennard Wolf
Lennard Wolf

Reputation: 88

If you are still looking for an answer.

Below: https://learn.microsoft.com/de-de/xamarin/xamarin-forms/platform/device

The using-directive Xamarin.Forms offers a function to get the runtime-platform. You can compare it to Android, WinRT, WinPhone, macOS, iOS, UWP. For example:

if (Device.RuntimePlatform.Equals(Device.UWP))
{

}

Furthermore you can also compare the device's idiom, to identify if your application is running on Phone, Tablet, ...

Upvotes: 2

Related Questions