Articles in this section
Category / Section

How to restrict the dropped event in TreeViewAdv?

1 min read

Set AllowDrop property

TreeViewAdv control allows you to drop the TreeView items from one location to another. This is done by enabling the AllowDrop property. This property can be set both TreeViewAdv and TreeViewItemAdv.

XAML for AllowDrop Property set TreeViewAdv

<syncfusion:TreeViewAdv x:Name="tree" AllowDrop="False" AllowDragDrop="True" ItemsSource="{Binding TreeItems}"></ syncfusion:TreeViewAdv >

XAML for AllowDrop Property set TreeViewItemAdv

<syncfusion:TreeViewAdv x:Name="tree1" syncfusion:TreeViewAdvDragEndCommand.Command="{Binding DropCommand}" syncfusion:TreeViewAdvDragEndCommand.CommandParameter="{Binding ElementName=tree, Path=SelectedItem}"  Grid.Column="1" AllowDragDrop="True"  ItemsSource="{Binding TreeItems1}">
<syncfusion:TreeViewAdv.ItemContainerStyle>
                <Style  TargetType="{x:Type syncfusion:TreeViewItemAdv}">
                    <Setter Property="AllowDrop" Value="False"/>
                </Style>
</syncfusion:TreeViewAdv.ItemContainerStyle>
</ syncfusion:TreeViewAdv >

C#

tree.AllowDrop = false;

Used here is the AllowDrop property to restrict the dropped element node. You can drag the TreeViewAdvItem from left to right, but not from right to left.

Figure 1: AllowDrop property

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied