-
Notifications
You must be signed in to change notification settings - Fork 127
/
DragDropBetweenTreeViewAndDataGridDemo.xaml
109 lines (101 loc) · 4.69 KB
/
DragDropBetweenTreeViewAndDataGridDemo.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<democommon:DemoControl
x:Class="syncfusion.treeviewdemos.wpf.DragDropBetweenTreeViewAndDataGridDemo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behavior="http://schemas.microsoft.com/xaml/behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:democommon="clr-namespace:syncfusion.demoscommon.wpf;assembly=syncfusion.demoscommon.wpf"
xmlns:local="clr-namespace:syncfusion.treeviewdemos.wpf"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="Drag drop between TreeView and DataGrid"
mc:Ignorable="d">
<democommon:DemoControl.DataContext>
<local:EmployeeInfoViewModel />
</democommon:DemoControl.DataContext>
<behavior:Interaction.Behaviors>
<local:DragDropBetweenTreeViewAndDataGridBehavior />
</behavior:Interaction.Behaviors>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid>
<syncfusion:SfTreeView
x:Name="sfTreeView"
Margin="10"
Width="160"
AllowDragging="True"
AllowDrop="True"
AutoExpandMode="AllNodes"
BorderThickness="1"
ChildPropertyName="Children"
FocusVisualStyle="{x:Null}"
FullRowSelect="True"
ItemsSource="{Binding TreeViewCollection}"
SelectionMode="Single"
Tag="1">
<syncfusion:SfTreeView.DragPreviewTemplate>
<DataTemplate>
<Border
x:Name="border"
Width="205"
Height="40"
Background="#ececec"
BorderBrush="#c8c8c8"
BorderThickness="1.2">
<Grid HorizontalAlignment="Left" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
Padding="8,0,0,0"
FontFamily="Segoe UI"
FontSize="12"
FontWeight="Regular"
Foreground="#333333"
Text="DropPosition: " />
<TextBlock
Grid.Column="1"
FontFamily="Segoe UI"
FontSize="12"
FontWeight="Regular"
Foreground="#333333"
Text="{Binding DragCaption}" />
</Grid>
</Border>
</DataTemplate>
</syncfusion:SfTreeView.DragPreviewTemplate>
<syncfusion:SfTreeView.ItemTemplate>
<DataTemplate>
<TextBlock VerticalAlignment="Center" Text="{Binding FirstName}" />
</DataTemplate>
</syncfusion:SfTreeView.ItemTemplate>
</syncfusion:SfTreeView>
</Grid>
<Grid Grid.Column="1">
<syncfusion:SfDataGrid
x:Name="sfDataGrid"
Grid.Row="1"
Margin="0,10,10,10"
AllowDraggingRows="True"
AllowDrop="True"
ColumnSizer="Star"
ItemsSource="{Binding DataGridCollection}"
RowDropIndicatorMode="Line">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn HeaderText="First Name" MappingName="FirstName" />
<syncfusion:GridTextColumn HeaderText="Last Name" MappingName="LastName" />
<syncfusion:GridTextColumn
HeaderText="ID"
MappingName="ID"
TextAlignment="Right" />
<syncfusion:GridTextColumn MappingName="Title" />
<syncfusion:GridCurrencyColumn MappingName="Salary" TextAlignment="Right"/>
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>
</Grid>
</Grid>
</democommon:DemoControl>