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






Gets or sets the drop behavior. Append child will add the item into panel's children collection. Replace will clear the current panel's children collection and add the new item. Custom will requires manual implementation.

Syntax

Visual Basic (Declaration) 
<CategoryAttribute("Behavior")>
Public Property DropBehavior As DropBehavior
Visual Basic (Usage)Copy Code
Dim instance As DropTargetBehavior
Dim value As DropBehavior
 
instance.DropBehavior = value
 
value = instance.DropBehavior
C# 
[CategoryAttribute("Behavior")]
public DropBehavior DropBehavior {get; set;}
Delphi 
public read-write property DropBehavior: DropBehavior; 
JScript 
CategoryAttribute("Behavior")
public function get,set DropBehavior : DropBehavior
Managed Extensions for C++ 
[CategoryAttribute("Behavior")]
public: __property DropBehavior get_DropBehavior();
public: __property void set_DropBehavior( 
   DropBehavior value
);
C++/CLI 
[CategoryAttribute("Behavior")]
public:
property DropBehavior DropBehavior {
   DropBehavior get();
   void set (    DropBehavior value);
}

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

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.

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.