Le Mot Juiced
Le Mot Juiced

Reputation: 3851

Xamarin: make Rg Plugins Popup in Xaml?

I am getting all sorts of weird errors trying to instantiate a popup page in Xaml. This is the most vexing:

No property, bindable property, or event found for 'Content', or mismatching type between value and property.

Here's the page presenting the popup:

<?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>

Here's its code-behind:

namespace PopupPages
{
    public partial class PopupBackingPage : ContentPage
    {

        public PopupBackingPage()
        {
            InitializeComponent();

        }

    }
}

Here's the popup page itself, in 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>

And here's the code-behind for the popup page itself:

namespace PopupPages
{
    public partial class PopupTest : Rg.Plugins.Popup.Pages.PopupPage
    {
        public PopupTest()
        {
            InitializeComponent();
        }
    }
}

What's going on? What am I doing wrong? These are as dead simple as can be.

Upvotes: 0

Views: 1136

Answers (1)

TaylorD
TaylorD

Reputation: 687

A Rg.Plugins.Popup is a page itself and can't be shown in a ContentPage. When wanting to display a popup page, display them using code like below:

await PopupNavigation.Instance.PushAsync(new PopupTest());

Put this code in the event that you were going to show the PopupBackingPage. A backing page is not needed and won't work with the Rg.Plugins.Popup pages.

Hopefully this helps!

Upvotes: 1

Related Questions