Search code examples
c#silverlightdrag-and-dropteleriksilverlight-toolkit

Silverlight toolkit's PanelDragDropTarget doesn't allow to drag n drop from right to left


I am using the Silverlight Toolkit's PanelDragDropTarget and the Telerik's RadWrapPanel as the panel container as shown in the below code:

                <controlsToolkit:PanelDragDropTarget Grid.Row="1" AllowDrop="True" AllowedSourceEffects="Move" x:Name="panelDragDropTarget"
                                                     ItemDragStarting="PanelDragDropTarget_ItemDragStarting"
                                                     HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
                                                     ItemDragCompleted="panelDragDropTarget_ItemDragCompleted"
                                                     MinWidth="1250" MinHeight="480"
                                                     HorizontalAlignment="Left" VerticalAlignment="Top">
                    <telerik:RadWrapPanel x:Name="WidgetsPanel" HorizontalAlignment="Left" VerticalAlignment="Top" Background="White"
                                      IsAnimated="True" AnimationDuration="100" AllowDrop="True" MinWidth="1250" MinHeight="480"></telerik:RadWrapPanel>
                </controlsToolkit:PanelDragDropTarget>

I add the controls in the RadWrapPanel at runtime and I am able to drag n drop the controls from left to right. But it doesn't allow me to drop the controls from right to left.

Any ideas how can I achieve the drag n drop on both directions e.g; both from left to right and right to left?


Solution

  • I was eventually able to achieve the drag n drop controls from both left to right as well as from right to left. The key point here is: instead of using telerik's RadWrapPanel the Silverlight Toolkit's WrapPanel should be used. The code below also supports the animation when controls are moved around.

                <controlsToolkit:PanelDragDropTarget Grid.Row="1" AllowDrop="True" AllowedSourceEffects="Move" x:Name="panelDragDropTarget"
                                                     ItemDragStarting="PanelDragDropTarget_ItemDragStarting"
                                                     HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
                                                     ItemDragCompleted="panelDragDropTarget_ItemDragCompleted"
                                                     MinWidth="1255" MinHeight="480"
                                                     HorizontalAlignment="Left" VerticalAlignment="Top">
                    <controlsToolkit:WrapPanel x:Name="WidgetsPanel" HorizontalAlignment="Left" VerticalAlignment="Top"
                                                     Background="White" AllowDrop="True" MinWidth="1255" MinHeight="480">
                        <i:Interaction.Behaviors>
                            <ei:FluidMoveBehavior AppliesTo="Children" FloatAbove="False" Duration="0:0:0.4" />
                        </i:Interaction.Behaviors>
                    </controlsToolkit:WrapPanel>
                </controlsToolkit:PanelDragDropTarget>