Intersoft ClientUI Documentation
DropTargetBehavior Class
Members  See Also  Send Feedback
Intersoft.Client.UI.Controls.Interactivity Namespace : DropTargetBehavior Class






Provides attached control with drop capability as the counter part / placeholder for object attached with a drag drop behavior.

Object Model

DropTargetBehavior Class

Syntax

Visual Basic (Declaration) 
<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)
Visual Basic (Usage)Copy Code
Dim instance As DropTargetBehavior
C# 
[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> 
Delphi 
public class DropTargetBehavior = class(Intersoft.Client.Framework.ISBehavior)
JScript 
DescriptionAttribute("Provides attached control with drop capability as the counter part / placeholder for object attached with a drag drop behavior.")
public class DropTargetBehavior extends Intersoft.Client.Framework.ISBehavior
Managed Extensions for C++ 
[DescriptionAttribute("Provides attached control with drop capability as the counter part / placeholder for object attached with a drag drop behavior.")]
public __gc class DropTargetBehavior : public Intersoft.Client.Framework.ISBehavior<UIElement> 
C++/CLI 
[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> 

Example

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>

Remarks

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:

  • AppendChild
    Remove the dragged object from original source and append it to drop target's children.
  • Replace
    Remove the dragged object from original source and replace the drop target's children.
  • Custom
    Requires user implementation on Drop event.

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.

Inheritance Hierarchy

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

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.