我正在尝试找到一种方法来区分我的应用程序是否在手机上作为 UWP 应用程序运行,或者手机上的 WinPhone 8.1 和 UWP 应用程序是否都具有 TargetPlatform.Windows 的 Device.OS。因此我无法找到一种方法来确定它是在手机中运行的 UWP 应用程序还是 Windows Phone 8.1 应用程序。有什么建议么?我的示例代码如下。
if ( Device.OS == TargetPlatform.Windows)
{
this.grdButtons.ColumnSpacing = 0;
}
最佳答案
如果您仍在寻找答案。
如下:https://learn.microsoft.com/de-de/xamarin/xamarin-forms/platform/device
using 指令 Xamarin.Forms
提供了获取运行时平台的函数。您可以将其与 Android、WinRT、WinPhone、macOS、iOS、UWP 进行比较。例如:
if (Device.RuntimePlatform.Equals(Device.UWP))
{
}
此外,您还可以比较设备的习惯用法,以确定您的应用程序是否在手机、平板电脑等上运行
关于c# - 在 Xamarin Forms 中检测 Windows Phone 8.1 与 Windows Phone 上的 UWPapp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40090323/