Xamarin:在Xaml中弹出Rg插件?
我在尝试用Xaml实例化弹出页面时遇到了各种奇怪的错误。这是最令人烦恼的: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
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();
}
}
}