首页 > 解决方案 > 框架 4.7 和 .Net 5.0 应用程序的内容控制区域的最新版本 prism 8.0.0.1909 异常?

问题描述

我创建了一个 WPF .Net 5 应用程序。WPF 应用程序与 Sample 2 Region 演示相同,它是一个 .Net Core 3.1 应用程序。运行 .Net WPF 应用程序时抛出异常,表示无法为 ContentControl 创建区域。

我使用相同版本的 Prism 制作了一个类似的 WPF .Net Framework 4.7 应用程序,并引发了相同的异常。

有没有其他人从任何地方听到过关于这件事的报道?

奇怪的是,如果我去 Sample2 Region 演示并将其更改为 .Net 5 应用程序运行正常。不会发生异常。

InnerException {“创建名为“ContentRegion”的区域时发生异常。异常是:System.Collections.Generic.KeyNotFoundException:类型 System.Windows.Controls.StackPanel 的 IRegionAdapter 未在区域适配器映射中注册。您可以通过覆盖引导程序中的 ConfigureRegionAdapterMappings 方法为此控件注册 IRegionAdapter。\r\n 在 G:\prism 文件夹\prism8net5\Prism-master\src\Wpf\Prism 中的 Prism.Regions.RegionAdapterMappings.GetMapping(Type controlType) .Wpf\Regions\RegionAdapterMappings.cs:line 80\r\n at Prism.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName) in G:\prism folder\prism8net5\Prism-master\src\Wpf\Prism .Wpf\Regions\Behaviors\DelayedRegionCreationBehavior.cs:第 132 行。“} System.Exception {Prism.Regions.Behaviors.RegionCreationException}

标签: wpfprism

解决方案


推荐阅读