如何将 Prism 7 WPF 集成到旧的大型 WinForms 应用程序中
How to integrate Prism 7 WPF into old, large WinForms App
我正在尝试将 (Prism 7) WPF Window 集成到现有的 WinForms 应用程序中。
我的window定义为:
<Window x:Class="ESC.SV.UI.RAndDClient.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ESC.SV.UI.RAndDClient"
xmlns:core="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:prism="http://www.codeplex.com/prism"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
Title="{Binding Title}" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<dxb:BarContainerControl Grid.Row="0">
<dxb:ToolBarControl Caption="Main Toolbar" BarItemHorizontalIndent="10">
<dxb:BarButtonItem Content="View 1" Glyph="{dx:DXImage Image=Forward_16x16.png}" Command="{Binding ExecuteView1Command}"/>
<dxb:BarButtonItem Content="View 2" Glyph="{dx:DXImage Image=Backward_16x16.png}" Command="{Binding ExecuteView2Command}"/>
</dxb:ToolBarControl>
</dxb:BarContainerControl>
<ContentControl prism:RegionManager.RegionName="ViewsRegion" Grid.Row="1" VerticalAlignment="Top"/>
</Grid>
当我启动 WinForms 应用程序并显示此 window 时,我收到以下错误消息:
... 这解释了在引导程序中覆盖 ConfigureRegionAdapterMappings 方法,但是当我去创建一个从 UnityBootstrapper 继承的 BootStrapper class 时,它说这现在已经过时了。我知道 App 应该继承自 PrismApplication,但这是否也适用于 WinForms 应用程序?
非常感谢任何有关如何处理这种情况的建议。
I know that App is supposed to inherit from PrismApplication, but does this apply to a WinForms application as well?
Prism 是一个 WPF 应用程序框架(以及 UWP 和 Xamarin)。它不支持 WinForms。也就是说,您当然可以单独使用 Prism 的各个部分,即使没有任何 GUI(例如,事件聚合器在 windows 服务中可以正常工作)。
您想从棱镜库中使用什么?基本上,对于每个功能,您必须查看引导程序如何初始化和配置它,然后使该初始化和配置适应您的应用程序。
我正在尝试将 (Prism 7) WPF Window 集成到现有的 WinForms 应用程序中。
我的window定义为:
<Window x:Class="ESC.SV.UI.RAndDClient.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ESC.SV.UI.RAndDClient"
xmlns:core="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:prism="http://www.codeplex.com/prism"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
Title="{Binding Title}" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<dxb:BarContainerControl Grid.Row="0">
<dxb:ToolBarControl Caption="Main Toolbar" BarItemHorizontalIndent="10">
<dxb:BarButtonItem Content="View 1" Glyph="{dx:DXImage Image=Forward_16x16.png}" Command="{Binding ExecuteView1Command}"/>
<dxb:BarButtonItem Content="View 2" Glyph="{dx:DXImage Image=Backward_16x16.png}" Command="{Binding ExecuteView2Command}"/>
</dxb:ToolBarControl>
</dxb:BarContainerControl>
<ContentControl prism:RegionManager.RegionName="ViewsRegion" Grid.Row="1" VerticalAlignment="Top"/>
</Grid>
当我启动 WinForms 应用程序并显示此 window 时,我收到以下错误消息:
... 这解释了在引导程序中覆盖 ConfigureRegionAdapterMappings 方法,但是当我去创建一个从 UnityBootstrapper 继承的 BootStrapper class 时,它说这现在已经过时了。我知道 App 应该继承自 PrismApplication,但这是否也适用于 WinForms 应用程序?
非常感谢任何有关如何处理这种情况的建议。
I know that App is supposed to inherit from PrismApplication, but does this apply to a WinForms application as well?
Prism 是一个 WPF 应用程序框架(以及 UWP 和 Xamarin)。它不支持 WinForms。也就是说,您当然可以单独使用 Prism 的各个部分,即使没有任何 GUI(例如,事件聚合器在 windows 服务中可以正常工作)。
您想从棱镜库中使用什么?基本上,对于每个功能,您必须查看引导程序如何初始化和配置它,然后使该初始化和配置适应您的应用程序。