Skip to content

Commit f9cb9bc

Browse files
Update README.md
1 parent 34c3b81 commit f9cb9bc

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# How to drag and drop rows in wpf between treegrid and treeviewadv?
1+
# How to Drag and Drop Rows between WPF TreeGrid and WPF TreeViewAdv?
22

3-
This example illustrates how to drag and drop rows in between [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) and [WPF TreeViewAdv](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.Controls.TreeViewAdv.html).
3+
This example illustrates how to drag and drop rows in between [WPF TreeGrid](https://www.syncfusion.com/wpf-controls/treegrid) (SfTreeGrid) and [WPF TreeViewAdv](https://help.syncfusion.com/wpf/classic/treeview/overview).
44

5-
You can drag and drop the items between `TreeViewAdv` and `TreeGrid` by wiring the [Drop](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridRowDragDropController.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridRowDragDropController_Drop) and [DragStart](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridRowDragDropController.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridRowDragDropController_DragStart) events from the [TreeGridRowDragDropController](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridRowDragDropController.html) class.
5+
You can drag and drop the items between TreeViewAdv and TreeGrid by wiring the [Drop](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridRowDragDropController.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridRowDragDropController_Drop) and [DragStart](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridRowDragDropController.html#Syncfusion_UI_Xaml_TreeGrid_TreeGridRowDragDropController_DragStart) events from the [TreeGridRowDragDropController](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeGrid.TreeGridRowDragDropController.html) class.
66

77
``` c#
88
private void RowDragDropController_DragStart(object sender, TreeGridRowDragStartEventArgs e)
@@ -51,6 +51,7 @@ private void RowDragDropController_Drop(object sender, TreeGridRowDropEventArgs
5151

5252
if (treeNode == null)
5353
return;
54+
5455
var data = treeNode.Item;
5556
AssociatedObject.sfTreeGrid.SelectionController.SuspendUpdates();
5657
var itemIndex = -1;
@@ -73,6 +74,7 @@ private void RowDragDropController_Drop(object sender, TreeGridRowDropEventArgs
7374
{
7475
if (!treeNode.IsExpanded)
7576
AssociatedObject.sfTreeGrid.ExpandNode(treeNode);
77+
7678
parentNode = treeNode;
7779
var parent = parentNode.Item as EmployeeInfo;
7880
newItem = new EmployeeInfo() { FirstName = record.FirstName, LastName = record.LastName, ID = record.ID, Salary = record.Salary, Title = record.Title, ReportsTo = parent.ID };
@@ -84,12 +86,9 @@ private void RowDragDropController_Drop(object sender, TreeGridRowDropEventArgs
8486
{
8587
if (treeNode.ParentNode != null)
8688
{
87-
8889
var collection = AssociatedObject.sfTreeGrid.View.GetPropertyAccessProvider().GetValue(treeNode.ParentNode.Item, AssociatedObject.sfTreeGrid.ChildPropertyName) as IEnumerable;
89-
9090
sourceCollection = GetSourceListCollection(collection);
9191
}
92-
9392
else
9493
{
9594
sourceCollection = GetSourceListCollection(AssociatedObject.sfTreeGrid.View.SourceCollection);
@@ -101,7 +100,6 @@ private void RowDragDropController_Drop(object sender, TreeGridRowDropEventArgs
101100
itemIndex += 1;
102101
}
103102
}
104-
105103
else if (dropPosition == "DropAsChild")
106104
{
107105
var collection = AssociatedObject.sfTreeGrid.View.GetPropertyAccessProvider().GetValue(data, AssociatedObject.sfTreeGrid.ChildPropertyName) as IEnumerable;
@@ -131,7 +129,7 @@ private void RowDragDropController_Drop(object sender, TreeGridRowDropEventArgs
131129
}
132130
```
133131

134-
In `TreeViewAdv`, you need to wire the `Drop` event,
132+
In TreeViewAdv, you need to wire the Drop event,
135133

136134
``` c#
137135
private void Treeview_Drop(object sender, DragEventArgs e)
@@ -151,4 +149,4 @@ private void Treeview_Drop(object sender, DragEventArgs e)
151149
(AssociatedObject.sfTreeGrid.ItemsSource as ObservableCollection<EmployeeInfo>).Remove(node.Item as EmployeeInfo);
152150
}
153151
}
154-
```
152+
```

0 commit comments

Comments
 (0)