Intersoft.Client.UI.Controls.Interactivity Namespace : DropTargetBehavior Class |
<DescriptionAttribute("Provides attached control with drop capability as the counter part / placeholder for object attached with a drag drop behavior.")> Public Class DropTargetBehavior Inherits Intersoft.Client.Framework.ISBehavior(Of UIElement)
Dim instance As DropTargetBehavior
[DescriptionAttribute("Provides attached control with drop capability as the counter part / placeholder for object attached with a drag drop behavior.")] public class DropTargetBehavior : Intersoft.Client.Framework.ISBehavior<UIElement>
[DescriptionAttribute("Provides attached control with drop capability as the counter part / placeholder for object attached with a drag drop behavior.")] public ref class DropTargetBehavior : public Intersoft.Client.Framework.ISBehavior<UIElement>
DropTargetBehavior 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 droppable, you can choose one of the following approaches:
AllowDrop property is only available in SL4 and WPF. |
With DropTargetBehavior, you can easily customize the tooltip when an object is being dragged over to a target element by specifying the TooltipIcon property and the TooltipText property. You can also determine the drop action from DropBehavior property if the drop target is a Panel element.
The following list explains several drop behaviors that you can apply:
To learn how to handle Drop event, see How to: Copy the dragged object when dropped to the drop target and How to: Remove the drag object when dropped to drop target.
All drag-drop related events including the DropEvent are built with routed events architecture. This allows you to handle the events anywhere in the visual tree. To learn more about routed event, see Routed Events Overview. |
The following code demonstrates how to make an UIElement droppable using DropTargetBehavior.
Dropable Grid Element |
Copy Code
|
---|---|
<Grid HorizontalAlignment="Center" Height="100" VerticalAlignment="Center" Width="100" Background="Gray" AllowDrop="True"> <i:Interaction.Behaviors> <Intersoft:DropTargetBehavior AllowDropItem="True" TooltipIcon="accept.png" TooltipText="Drop here."/> </i:Interaction.Behaviors> </Grid> |
Dropable ListBox |
Copy Code
|
---|---|
<ListBox HorizontalAlignment="Center" Height="100" VerticalAlignment="Center" Width="100"> <i:Interaction.Behaviors> <Intersoft:DropTargetBehavior AllowDropItem="True" DropBehavior="Custom" TooltipIcon="accept.png" TooltipText="Drop here."//> </i:Interaction.Behaviors> </ListBox> |
System.Object
System.Windows.DependencyObject
System.Windows.Interactivity.Behavior
System.Windows.Interactivity.Behavior<T>
Intersoft.Client.Framework.ISBehavior<T>
Intersoft.Client.UI.Controls.Interactivity.DropTargetBehavior
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