在Xamarin.Forms中单击背景时,Rg.Plugins.Popup没有关闭 [英] Rg.Plugins.Popup is not closing when background is clicked in Xamarin.Forms

查看:604
本文介绍了在Xamarin.Forms中单击背景时,Rg.Plugins.Popup没有关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序中使用了rg.plugins.popup.我已经更新了xamarin表单(版本="2.5.0.121934").现在单击外部背景,它没有关闭.我曾经以多种方式关闭弹出窗口,但没有关闭,我尝试了以下代码:

I have used rg.plugins.popup in my application. I have updated the xamarin forms (version="2.5.0.121934"). Now the outer background is clicked it is not closed. I used to close the popup many ways, but not closed, I tried the below code:

this.CloseWhenBackgroundIsClicked = false;

this.CloseWhenBackgroundIsClicked = false;

protected override bool OnBackgroundClicked()
        {
            Navigation.PopPopupAsync();
            return false;
        }   

OnBackgroundClicked没有呼叫.如何解决此问题?

OnBackgroundClicked is not calling. How to fix this issue?

推荐答案

我不知道您是否知道正确的代码是:this.CloseWhenBackgroundIsClicked = true;(不是false),但是如果不起作用,您可以尝试解决方法直到这个问题解决为止.

I don't understand if you know that the correct code is: this.CloseWhenBackgroundIsClicked = true; (not false), but if this is not working you could try a workaround until this problem is solved.

基本上,添加一个Grid作为PopupPage的根,并添加一个带有TapGestureRecognizer的Colorless BoxView作为Grid的子元素,然后将实际内容添加为Grid的另一个子元素,并将TapGestureRecognizer的Tapped设置为"BackgroundClicked"代码.

Basically, add a Grid as the root of your PopupPage and add a Colorless BoxView with a TapGestureRecognizer as a child of the Grid, then just add the actual content as another child of the Grid and set the Tapped of the TapGestureRecognizer to the "BackgroundClicked" code.

希望有帮助!

这篇关于在Xamarin.Forms中单击背景时,Rg.Plugins.Popup没有关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆