wpf - opening a prism module on new window on a registered region -
i have application various modules.
i have divided main shell (xaml) different regions , can load modules on regions.
but have requirement in on click of button have open new window , new module load on new window.
i created new window , opening window , window having region regionmanager of main application not recognize.
how load module on region not on main window on child window ?
you can find quick sample solution problem in following skydrive public folder "regioninchildwindowwithnavigation":
based on understanding, problem mentioned related on setting regionmanager
property on childwindow view cause defined modalwindowregion
reachable regionmanager
. below modaldialog
childwindow view constructor aforemention sample. notice adds event handler remove views in childwindow when closed.
[importingconstructor] public modaldialog(iregionmanager rm) { this.rm = rm; this.setvalue(regionmanager.regionmanagerproperty, rm); initializecomponent(); this.closed += new eventhandler(windowsview_closed); } void windowsview_closed(object sender, eventargs e) { while (rm.regions["modalwindowregion"].views.count() > 0) { rm.regions["modalwindowregion"].remove(rm.regions["modalwindowregion"].views.firstordefault()); } }
then, need requestnavigate()
specified region defined in childwindow view regionmanager
follows:
modaldialogwindow.show(); rm.requestnavigate("modalwindowregion", new uri("helloworldview", urikind.relative));
in addition, may find useful following codeplex threads:
i hope helps.
Comments
Post a Comment