cag

In Composite WPF (Prism), what is the difference between IRegion.Add and IRegionManager.RegisterViewWithRegion?

我只是一个虾纸丫 提交于 2019-12-20 18:07:03
问题 In Composite WPF (Prism), when adding modules to the IRegionManger collection, what is the difference between using IRegion.Add and IRegionManager.RegisterViewWithRegion? IRegion.Add public void Initialize() { _regionManager.Regions["MainRegion"].Add( new ModuleAView() ); } IRegionManager.RegisterViewWithRegion public void Initialize() { _regionManager.RegisterViewWithRegion( "MainRegion", typeof( ModuleAView ) ); } 回答1: The difference is who is responsible for creating the view. In the

How to use Prism within an ElementHost

最后都变了- 提交于 2019-11-28 06:32:50
问题 I'm new to Prism and I am attempting to host a Prisim control within an ElementHost. I seem to be missing something very basic. I have a single WinForm that contains an ElementHost. The following code is in the form: public partial class Form1 : Form { public Form1() { InitializeComponent(); Bootstrapper bootstrapper = new Bootstrapper(); bootstrapper.Run(); var child = bootstrapper.Container.Resolve<Shell>(); elementHost.Child = child; } The BootStrapper handles regisration public class