对于UWP,我需要在
以下代码会使应用程序崩溃。
Grid
中为列的宽度设置不同的大小。此外,在平板电脑和智能手机上该值也应不同。以下代码会使应用程序崩溃。
<ColumnDefinition>
<ColumnDefinition.Width>
<OnIdiom.Phone>
<OnPlatform x:TypeArguments="GridLength" iOS="*" Android="*" WinPhone="100" />
</OnIdiom.Phone>
<OnIdiom.Tablet>
<OnPlatform x:TypeArguments="GridLength" iOS="*" Android="*" WinPhone="200" />
</OnIdiom.Tablet>
</ColumnDefinition.Width>
</ColumnDefinition>
带有
在xmlns http://xamarin.com/schemas/2014/forms中找不到Type OnIdiom.Phone。
该代码位于ViewCell
中。因此,我无法使用额外的ResourceDictionary
,并且OnSizeAllocated()
在代码后台文件中也不可用。
是否可能同时使用OnIdiom
和OnPlatform
?
Device.OS
是Windows
,而Device.Idiom
是Desktop
。在 XAML 中是否有相应的定义?之前使用WinPhone
没有问题。 - testingDesktop
的支持已于几天前在https://github.com/xamarin/Xamarin.Forms/pull/420中实现。该修复程序将出现在即将发布的2.3.4-pre1版本中。 - Stephane Delcroix