Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin:在Xaml中弹出Rg插件?_Xaml_Xamarin_Xamarin.forms - Fatal编程技术网

Xamarin:在Xaml中弹出Rg插件?

Xamarin:在Xaml中弹出Rg插件?,xaml,xamarin,xamarin.forms,Xaml,Xamarin,Xamarin.forms,我在尝试用Xaml实例化弹出页面时遇到了各种奇怪的错误。这是最令人烦恼的: No property, bindable property, or event found for 'Content', or mismatching type between value and property. 以下是显示弹出窗口的页面: <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns ="http://xam

我在尝试用Xaml实例化弹出页面时遇到了各种奇怪的错误。这是最令人烦恼的:

No property, bindable property, or event found for 'Content', or mismatching type between value and property.
以下是显示弹出窗口的页面:

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns         ="http://xamarin.com/schemas/2014/forms"
             xmlns:x        ="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class        ="PopupPages.PopupBackingPage"
             xmlns:popup            ="clr-namespace:PopupPages"
             BackgroundColor="Transparent">
    <popup:PopupTest />
</ContentPage>
以下是弹出页面本身,用xaml表示:

<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage 
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
    xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
    x:Class="PopupPages.PopupTest">
</pages:PopupPage>

发生什么事了?我做错了什么?这些都非常简单。

A
Rg.Plugins.Popup
本身就是一个页面,不能在
内容页面中显示。要显示弹出页面时,请使用如下代码显示:

等待PopupNavigation.Instance.PushAsync(新的PopupTest());
将此代码放在要显示
popubackingpage
的事件中。不需要备份页,并且不能与
Rg.Plugins.Popup
页面一起使用


希望这有帮助

如果您遵循@TaylorD的答案,您可以添加
await-PopupNavigation.Instance.PushAsync(new-PopupTest())
popubackingpage()中
InitializeComponent()之后
并从XAML代码中删除
<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage 
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
    xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
    x:Class="PopupPages.PopupTest">
</pages:PopupPage>
namespace PopupPages
{
    public partial class PopupTest : Rg.Plugins.Popup.Pages.PopupPage
    {
        public PopupTest()
        {
            InitializeComponent();
        }
    }
}