无法激活类型NavigationPageRenderer的实例 [英] Unable to activate instance of type NavigationPageRenderer

查看:83
本文介绍了无法激活类型NavigationPageRenderer的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MasterDetailPage,并且此页面被推送到导航:

I have a MasterDetailPage and this page get pushed to a Navigation:

await MainPage.Navigation.PushAsync(new MasterDevicePage());

当加载主设备页面时,主页面的列表视图将选择页面之一并将其显示在详细信息屏幕上.

when the master device page get loaded, the master page's list view will then select one of the page and display it on the detail screen.

masterPage.ListView.ItemSelected += (sender, e) =>
        {
            var item = e.SelectedItem as MasterPageModel;
            if (item != null)
            {
                Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType));
                Detail.Title = item.Title;
                masterPage.ListView.SelectedItem = null;
                IsPresented = false;
            }
        };

该错误发生在细节=新的NavigationPage"部分.

The error occurs at the Detail = new NavigationPage part.

找不到用于的构造函数 Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer ::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership)

No constructor found for Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer::.ctor(System.IntPtr, Android.Runtime.JniHandleOwnership)

无法激活类型的实例 Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer来自 本地句柄0x85300019(key_handle 0x42c360f8).

Unable to activate instance of type Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer from native handle 0x85300019 (key_handle 0x42c360f8).

推荐答案

您可以尝试修复提供构造函数的

You can try to fix it supplying constructor

public YourClass (IntPtr javaReference, JniHandleOwnership transfer)
            : base ()
        {
        }

但是 永远不要将MasterDetailPage推送到导航堆栈.

BUT MasterDetailPage should be never pushed to Navigation stack.

这篇关于无法激活类型NavigationPageRenderer的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆