Drag & Drop Module in the shell

Topics: Prism v2 - WPF 3.5
Jun 4, 2009 at 2:07 PM


I am a new developper in WPF C# and since one month I am (try ) using Prism.

Now, I already created 4 differents modules and each module is related to one region. I also included a grid in my shell in order to place the different module. (I don't really know if it's the good behaviour.)

 <ItemsControl Margin="0,5,5,0" Grid.Row="1" Grid.Column="0"  Width="500" cal:RegionManager.RegionName="{x:Static infrastructure:RegionNames.AdherentRegion}" />
 <ItemsControl Margin="5,5,0,0"  Grid.Row="1" Grid.Column="1" Width="500" cal:RegionManager.RegionName="{x:Static infrastructure:RegionNames.ContratRegion}" />

Now, I want to add a behavior for my region / module  in order to be able to select one module and to drag and drop it to another place in the shell. (Exactly as the same behaviour of portlet in Igoogle for example)

I was looking in discussion and in the documentation but i didn't find any answer for this question.

Thanks for your help








Jun 8, 2009 at 7:08 PM

Hi Vlado,


Last week I created a small spike to be able to drag and drop views between different modules. Perhaps you can find it useful:

·         How to: Drag and Drop WPF Views between Regions in Prism-v2


Please let me know if this helps.


Damian Schenkelman


Jun 9, 2009 at 8:31 AM

Thanks you for your answer :)

I am going to try this methods right away.



Jun 9, 2009 at 11:21 AM
Edited Jun 9, 2009 at 3:41 PM

Ok it works very good, thank you for your help Damian.

I will just have to make a little change in order to improve the behavior :

For the moment I drop one view in another region where there is already a view. I just have to take this view and to put in the first region where there isn't any view after the move.

I hope this won't be difficult, I am just a beginner in C# :)


It works fine :)

I changed one part in the code of the ViewDragManager :

I only have one View for each Module at this state, that's why I used Views.First().

 foreach (var region in regionManager.Regions)
                    if (region.Views.Contains(view) && region.Name.CompareTo(dropRegionName)!=0)
                        var actualView = regionManager.Regions[dropRegionName].Views ;