Intersoft.Client.UI.Controls.Interactivity Namespace : DragDropPointBehavior Class |
<DescriptionAttribute("Provides attached control with drag drop capability. The attached object must be the inner element / part of a complex structure.")> Public Class DragDropPointBehavior Inherits Intersoft.Client.Framework.ISBehavior(Of UIElement)
Dim instance As DragDropPointBehavior
[DescriptionAttribute("Provides attached control with drag drop capability. The attached object must be the inner element / part of a complex structure.")] public class DragDropPointBehavior : Intersoft.Client.Framework.ISBehavior<UIElement>
[DescriptionAttribute("Provides attached control with drag drop capability. The attached object must be the inner element / part of a complex structure.")] public ref class DragDropPointBehavior : public Intersoft.Client.Framework.ISBehavior<UIElement>
DragDropPointBehavior is part of ClientUI drag-drop framework library, to learn more about ClientUI Drag-drop Library see Drag-drop Framework Overview.
To make an UIElement dragable, simply attach a DragDropBehavior to that particular elements as shown in the XAML code below.
XAML |
Copy Code
|
---|---|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <i:Interaction.Behaviors> <Intersoft:DragDropBehavior/> </i:Interaction.Behaviors> <Image Source="folder.png" Height="64" Width="64"/> <TextBlock Text="My Archive" HorizontalAlignment="Center" VerticalAlignment="Center"/> </StackPanel> |
In the above sample, the DragDropBehavior is attached to a StackPanel that has an image and a text element.
The side effect of this concept is that you can start the drag-drop operation by dragging any elements within the StackPanel, which might not always be desirable. To make only certain elements dragable, you attach a DragDropPointBehavior to the desired dragable element which is the children element of the StackPanel.
The following code shows how you can limit the drag source to an Image element.
XAML |
Copy Code
|
---|---|
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top"> <i:Interaction.Behaviors> <Intersoft:DragDropBehavior IsDragable="False"/> </i:Interaction.Behaviors> <Image Source="folder.png" Height="64" Width="64"> <i:Interaction.Behaviors> <Intersoft:DragDropPointBehavior IsDragable="True"/> </i:Interaction.Behaviors> </Image> <TextBlock Text="My Archive" HorizontalAlignment="Center" VerticalAlignment="Center"/> </StackPanel> |
System.Object
System.Windows.DependencyObject
System.Windows.Interactivity.Behavior
System.Windows.Interactivity.Behavior<T>
Intersoft.Client.Framework.ISBehavior<T>
Intersoft.Client.UI.Controls.Interactivity.DragDropPointBehavior
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2