【问题标题】:Is there a way to disable Xamarin Forms SwipeGestureRecognizer on Desktop?有没有办法在桌面上禁用 Xamarin Forms SwipeGestureRecognizer?
【发布时间】:2020-01-16 19:06:26
【问题描述】:

我有一个 Xamarin Forms 应用程序,我想知道是否可以仅允许 SwipeGestureRecognizer 用于手机(或小屏幕)。

我正在使用具有 2 个内容视图的视图。在桌面上我想在屏幕上看到它们,但在手机上我想单独看到它们(滑动手势)。

        <ContentView.GestureRecognizers>
            <SwipeGestureRecognizer Command="{Binding SwipedViewCommand}" Direction="Right" />
        </ContentView.GestureRecognizers>

该命令反转布尔值,每个内容视图都可见绑定到该布尔值(一个检查真,另一个检查假)

https://docs.microsoft.com/es-es/xamarin/xamarin-forms/app-fundamentals/gestures/swipe

【问题讨论】:

  • 您是指您自己添加到视图中的手势,还是内置到视图中的现有手势?
  • 对不起。我已经更新了这个问题。你能再检查一下吗?
  • 是的,但是如何将 onIdiom 与 SwipeGestureRecognizer 一起使用?
  • 不确定在 XAML 中,我可能会在代码中这样做

标签: xamarin.forms swipe-gesture


【解决方案1】:

XF 有问题:https://github.com/xamarin/Xamarin.Forms/issues/8756

同时可以设置CanExecuteCommand

new Command(() =&gt; { }, () =&gt; Device.Idiom == TargetIdiom.Phone);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-07-20
    • 1970-01-01
    • 2019-12-10
    • 1970-01-01
    • 2015-06-09
    • 2019-12-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多