在 Xamarin.Forms 中单击背景时,Rg.Plugins.Popup 不会关闭

Kar*_*ick 0 xamarin.ios xamarin.android xamarin.forms

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

this.CloseWhenBackgroundIsClicked = false;

protected override bool OnBackgroundClicked()
        {
            Navigation.PopPopupAsync();
            return false;
        }   
Run Code Online (Sandbox Code Playgroud)

OnBackgroundClicked不是在打电话。如何解决这个问题?

Luc*_*zar 5

我不明白您是否知道正确的代码是:(this.CloseWhenBackgroundIsClicked = true;不是错误的),但是如果这不起作用,您可以尝试一种解决方法,直到此问题得到解决。

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

希望能帮助到你!