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

时间:2017-04-12 15:14:11

标签: xamarin layout xamarin.forms

我有两个嵌套的StackLayouts:

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

我想在外部StackLayout上添加click事件,当单击内部StackLayout时不会触发该事件。是否有可能在Xamarin表格?如果我可以过滤点击事件(使用if块),我也会很高兴。

1 个答案:

答案 0 :(得分:2)

我想你可以看看Rg Plugin popup

它有这个属性

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