xamarin.forms - 在特定平台上添加 TapGestureRecognizer
问题描述
TapGestureRecognizer
是否可以仅在 UWP 上添加一个?像这样的东西
<OnPlatform x:TypeArguments="GestureRecognizers">
<OnPlatform.Platforms>
<On Platform="UWP">
<TapGestureRecognizer Command="{Binding MyUWPCommand}"/>
</On>
</OnPlatform.Platforms>
</OnPlatform>
解决方案
在 XAML 中:
<OnPlatform x:TypeArguments="Label">
<On Platform="UWP">
<Label Text="TapGestureRecognizer for UWP">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding MyUWPCommand}" />
</Label.GestureRecognizers>
</Label>
</On>
<On Platform="Android, iOS">
<Label Text="No GestureRecognizers for Android, iOS" />
</On>
</OnPlatform>
推荐阅读
- java - MySQL 员工数据库 java.sql.SQLException: url 不能为空
- google-app-engine - 使用谷歌应用引擎设置自定义“A”资源记录以避免重定向
- django - 我的路由器在 django rest 框架工作 1.11 上工作,但此代码在 django rest 框架工作 2 中不起作用
- netsuite - NetSuite SuiteScript SSS_CONNECTION_CLOSED
- dll - 将 TeamFoundation dll 升级到 2017 后出现 MSBuild 错误
- java - 提取字符串的正则表达式从 '=' 开始,以 '\t' 结束
- uglifyjs - 如何将 uglifyjs 3 mangle 选项与 toplevel 和 reserverd 一起使用?
- java - 检查 HashMap 中是否存在 String 的一部分
- php - 从关联数组动态构造更新语句
- windows - 在 Windows 上自定义编译 Tesseract-ocr (4.0)