简体   繁体   English

如何在Xamarin表单中将TapGestureRecognizer添加到外部StackLayout

[英]How to add TapGestureRecognizer to outer StackLayout in Xamarin Forms

I have two nested StackLayouts: 我有两个嵌套的StackLayouts:

<StackLayout>
  <StackLayout>
  </StackLayout>
</StackLayout>

I would like to add click event on outer StackLayout that will not be triggered when inner StackLayout is clicked. 我想在外部StackLayout上添加单击事件,单击内部StackLayout时不会触发该事件。 Is it possible in Xamarin Forms? Xamarin形式有可能吗? If I can filter click event (with if block) I would also be happy. 如果我可以过滤click事件(带有if块),我也会很高兴。

I think you can take a look to Rg Plugin popup . 我认为您可以看看Rg Plugin弹出窗口

it has this property 它具有此属性

CloseWhenBackgroundIsClicked: Close pop-up when click on the background CloseWhenBackgroundIsClicked:单击背景时关闭弹出窗口

You can add what you want to this popup because you can add a ContentPage

// Use these methods in PopupNavigation globally or Navigation in your pages

// Open new PopupPage
Task PushAsync(PopupPage page, bool animate = true) // Navigation.PushPopupAsync

// Hide last PopupPage
Task PopAsync(bool animate = true) // Navigation.PopPopupAsync

// Hide all PopupPage with animations
Task PopAllAsync(bool animate = true) // Navigation.PopAllPopupAsync

// Remove one popup page in stack
Task RemovePageAsync(PopupPage page, bool animate = true) // Navigation.RemovePopupPageAsync

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM