wpf - Injecting view from one module into another view in a second module -


i need figuring out how inject view 1 module view in second module, using prism library.

i have createorderview inside order module. view gets injected region in shell. need display personcardview inside createorderview. personcardview view phonebookmodule.

the view model personcardview takes person argument in constructor contains data view display.

in createorderview, how can define "placeholder" "inject" personcardview? don't think appropiate define region here since it's single view, , nothing else. if 2 views in same module, include this:

<personcardview datacontext="{binding personcardviewmodel}"/> 

createorderviewmodel of course hold property called personcardviewmodel containing viewmodel personcardview.

but can't see how way unless create reference between 2 modules , avoid that.

any ideas? how have approached issue?

you have 2 options, can see.

your first option use regions. regions fine 1 control:

<contentcontrol regionmanager.region="mycrossmoduleregion" /> 

this work fine. no reference between 2 required.

the second option have module consumes view other module (we'll call consuming module) provide service other module producing view (we'll call producing module) consuming module can factory views. example make clear.

//what consuming module expose via container public interface ipersoncardproviderregistrationservice {      void registerprovider(ipersoncardprovider provider); }  //what producing module implement , pass consuming module via above interface public interface ipersoncardprovider {      //if need interactivity, interface,      //but if it's readonly data , little no activity, object      //is valid type here      object getpersoncardview(long personid); } 

in way, consuming module can use provider view each person want show. producing module pass provider consuming module via registerprovider call. producing module have moduledependency on consuming module in scenario, only assembly reference necessary 3rd assembly 2 interfaces in (we call "contracts" assembly, that's not industry standard term or anything).


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -