I have a C# application in which I am implementing a drag drop functionality as following;
<Grid>
<StackPanel Orientation="Horizontal" Height="34" VerticalAlignment="Top">
<TextBlock Text="This is satck panel 1" Padding="0, 10, 20, 10"/>
<StackPanel Orientation="Horizontal" AllowDrop="True" DragEnter="StackPanel_DragEnter" DragLeave="StackPanel_DragLeave" DragOver="StackPanel_DragOver" Drop="StackPanel_Drop" MouseMove="StackPanel_MouseMove" GiveFeedback="StackPanel_GiveFeedback" >
<Border CornerRadius="1" BorderBrush="Black" BorderThickness="1">
<TextBlock Text="Text1"/>
</Border>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="30" Margin="0,40" VerticalAlignment="Top">
<TextBlock Text="This is stack panel 2" Padding="0,10,20,10"/>
<Border CornerRadius="1" BorderBrush="Black" BorderThickness="1">
<TextBlock Text="Text2"/>
</Border>
</StackPanel>
</Grid>
What I actually have to do this is to populate a list box with the each item having the follwing format:
StackPanel> <TextBlock> </TextBlock> **<StackPanel AllowDrop> <TextBlock /> </StackPanel>** </StackPanel>
The StackPanel with AllowDrop=True should accept TextBlock drops (The text blcoks can be dropped from other stack panels). If the TextBlock is dropped over the StackPanel AllowDrop=True, it should accept it as its child and replace the TextBlock with the place from where the dragged TextBlcok came. I have implemented this by looking at the documentation but this doesn’t like working since I am able to use DragEnter, Drag Leave but not able to drop the text box.
I am also attaching my short sample project (54 kB) where I implemed the same and this is not working. Link: http://www.mediafire.com/?ssvf95oa8bd5jh6
Maybe this can you in the right way, i made it when i needed to drag and drop a row from one grid to a second grid
http://johnnblade.wordpress.com/2012/06/12/drag-and-drop-grid-control-row-devexpress-wpf/