Articles in this section
Category / Section

How to show corresponding dragging row data in draggable popup in WPF TreeGrid?

5 mins read

WPF TreeGrid (SfTreeGrid) displays the RowCount and DropStatus in a draggable popup while drag-and-drop operation. You can customize the dragging popup to show the corresponding drag row data by customizing the RowDragDropTemplate with binding the data from the DraggingNodes property.

<Window.Resources>
    <DataTemplate x:Key="dragdroptemplate">
        <Border x:Name="border" 
                Width="250"    
                Background="#ececec"   
                BorderBrush="#c8c8c8"  
                Height="60"  
                BorderThickness="1.2">
            <Grid  VerticalAlignment="Center" 
                   HorizontalAlignment="Left">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock Text="FirstName : " 
                           Grid.Row="0" 
                           Grid.Column="0" />
                <TextBlock Text="{Binding DraggingNodes[0].Item.FirstName}" 
                           Grid.Row="0" 
                           Grid.Column="1"/>
                <TextBlock Text="LastName : " 
                           Grid.Row="1" 
                           Grid.Column="0"/>
                <TextBlock Text="{Binding DraggingNodes[0].Item.LastName}" 
                           Grid.Row="1"
                           Grid.Column="1"/>
            </Grid>
        </Border>
    </DataTemplate>
</Window.Resources>

<syncfusion:SfTreeGrid Name="treeGrid"
                       AutoGenerateColumns="False"
                       AllowEditing="True"                               
                       ChildPropertyName="ReportsTo"
                       ParentPropertyName="ID"                               
                       SelfRelationRootValue="-1"
                       ItemsSource="{Binding Employees}"
                       RowDragDropTemplate="{StaticResource dragdroptemplate}"
                       AllowDraggingRows="True"
                       AllowDrop="True" />

Customized draggable popup in SfTreeGrid


The following screenshot shows customizing draggable Popup to show corresponding dragging row data in WPF TreeGrid.

Customizing draggable Popup to show corresponding dragging row data in SfTreeGrid


Take a moment to peruse the WPF TreeGrid - drag and drop row documentation, where you can find about drag and drop row with code examples.

View sample in GitHub

Conclusion

I hope you enjoyed learning about how to show corresponding dragging row data in draggable popup in TreeGrid
You can refer to our WPF TreeGrid  feature tour page to know about its other groundbreaking feature representations. You can also explore documentation to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!
Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied