Dynamic creation of a view

Topics: Prism v2 - Silverlight 3
Nov 8, 2009 at 7:14 AM

Hi all,

I’m new using Prism V2 and currently I cannot figure out how to resolve the following scenario.

We have a Silverlight application that displays various widgets (panels with different contents). Consider each widget as a View which is implemented into a different Module. The Shell has 2 regions. The first one displays just a list with the widget names from all available widgets in the modules. The second one is just an empty region where a user can drop a view into it. Dragging an item from the list (1<sup>st</sup> region) into the 2<sup>nd</sup> region should display the appropriate view.

Is there a way to do that?

Thanks in advance,
Greg

Nov 9, 2009 at 4:35 PM

Hi Greg,

I assume the list with the widget names is a region, and modules add different views to it, based on the widgets they provide. If this is the case, some time ago I blogged about dragging views from one region to another, so you might find this post useful.

Take into account that the post does not account for your full scenario, as it simply drags the view between different regions but does not show a new view when dropping. However, with some minor changes you should be able to get it working.

Please let me know if this helps.

Damian Schenkelman
http://blogs.southworks.net/dschenkelman

Nov 11, 2009 at 2:43 PM

That is a great idea. I will try it out.

Many thanks,
Greg