WPF Prism MVVM - Same "Partial View with Command" in one page, how to subscribe the Command? -


my project using mvvm design pattern using prism , unity, following famous prism video brian lagunas, video didn't mention how create/use partial view, user control used in other user controls.

i'm trying create custom partial view(usercontrol) can reused in other page (user control). example, view contains "browse" button binding selectfilecommand , publish file path when done. if have 2 of view in 1 page, how can subscribe correct command? both commands called same name.

for using partial view:

register view type in module this:

container.registertype<ipartialview, partialview>(); 

and use view directly in page this:

<views:partialview datacontext="{binding partialviewmodel}" /> 

i'm not sure if correct way implement prism mvvm pattern. please let me know if wrong idea, , how implement these kind of partial view.

thanks lot.

i'm not sure understand need i'll give try.

if partial view in module, first, can't use elsewhere in same module. use ipartialview, i'm not sure needed here, prism gives simpler solutions.

the simplest way think want have region want have partial view. use registerviewwithregion in module definition register partialview against corresponding region(s). way, if have partial view several times, have several regions same name, , 1 registration of partialview in module. give right datacontext each region.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -