Xamarin.Forms.WPF XamlParseException

我按照本教程将 WPF 项目包含到我的 Xamarin.Forms 解决方案中。完成所有步骤并比较相等后,应用程序启动,但立即运行异常。


Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll

Additional information: Zeilennummer "7" und Zeilenposition "9" von "Durch den Aufruf des Konstruktors für Typ "Cheetah.Forms.WPF.MainWindow", der den angegebenen Bindungseinschränkungen entspricht, wurde eine Ausnahme ausgelöst.".

这是我的 Xaml 文件


<wpf:FormsApplicationPage x:Class="Cheetah.Forms.WPF.MainWindow"

                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

                      xmlns:wpf="clr-namespace:Xamarin.Forms.Platform.WPF;assembly=Xamarin.Forms.Platform.WPF"

                      mc:Ignorable="d"

    Title="MainWindow" Height="450" Width="800">

</wpf:FormsApplicationPage>

这是代码隐藏:


using Xamarin.Forms.Platform.WPF;


namespace Cheetah.Forms.WPF

{

    public partial class MainWindow : FormsApplicationPage

    {

        public MainWindow()

        {

            InitializeComponent();

            Xamarin.Forms.Forms.Init();

            LoadApplication(new Cheetah.Forms.App());

        }

    }

}

我找不到,我错过了什么或做错了什么,所以这可能是一个错误吗?


吃鸡游戏
浏览 75回答 1
1回答

翻翻过去那场雪

在工具 -> 选项 -> 调试下选中“仅我的代码”后,我看到了引发异常的原因:我必须导入从我的 Forms 项目引用的所有 Nuget。在我这样做之后,应用程序按预期启动!
打开App,查看更多内容
随时随地看视频慕课网APP