简体   繁体   中英

Why am I getting this error after upgrading to Xamarin Forms 2.0?

For context, I am creating an activity indicator in Xamarin Forms that brings up a new transparent page so it blocks user interaction.

Anyway,

Everything is fine with Xamarin Forms 1.3, but when I upgrade to XF 2.0, I'm getting this issue.

在此处输入图片说明

Here is my code behind for the Xaml

在此处输入图片说明

ModalSpinnerPage 在此处输入图片说明

From the auto generated class, It looks like Xamarin thinks my ModalSpinnerPage is a member of Xamarin Forms (although its clearly not)

在此处输入图片说明

Again, my problem is that after the Xamarin forms upgrade, Xamarin thinks my ModalSpinnerPage is a member of Xamarin Forms. Everything is fine before the upgrade though. Any help on this would be awesome. Thanks

You need to add correct namespaces:

<sp:ModalSpinnerClass xmlns:sp="clr-namespace:XSpinner.FormsPlugin;assembly=XSpinner.PutHereCorrectAssemblyPath" /* the rest of properties */>

</sp:ModalSpinnerClass>

Here it's working example (using custom pages as a base): link

The following code can work:

<ModelSpinner:ModelSpinnerPage xmlns="http://xamarin.com/schemas/2014/forms"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:ModelSpinner="clr-namespace:XSpinner.FormsPlugin"
         x:Class="XSpinner.FormsPlugin.ModelPageSpinner">
</ModelSpinner>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM