-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
86 lines (83 loc) · 3.5 KB
/
MainWindow.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
<?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="TreeViewItemDropIssue.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:TreeViewItemDropIssue"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="TreeViewItemDropIssue">
<StackPanel
Orientation="Horizontal"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="500"
Height="500"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid
CanDrag="True"
DragStarting="Grid_DragStarting"
Height="130"
Width="130"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="LightPink"
BorderThickness="1"
BorderBrush="HotPink">
<TextBlock
Text="Drag Me!"
FontSize="22"
FontWeight="Bold"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Grid>
<Grid
VerticalAlignment="Top"
Margin="20, 0, 0, 0"
BorderThickness="1"
BorderBrush="{ThemeResource SystemControlForegroundBaseMediumLowBrush}">
<Grid.Resources>
<local:TreeViewTemplateSelector x:Key="TreeViewTemplateSelector">
<local:TreeViewTemplateSelector.GroupTemplate>
<DataTemplate x:DataType="local:TreeViewTestGroupItem">
<TreeViewItem
Content="{x:Bind Title}"
ItemsSource="{x:Bind MembersItemSource}"
AllowDrop="False"
CanDrag="False"
FontWeight="SemiBold"/>
</DataTemplate>
</local:TreeViewTemplateSelector.GroupTemplate>
<local:TreeViewTemplateSelector.MemberTemplate>
<DataTemplate x:DataType="local:TreeViewTestMemberItem">
<TreeViewItem
Content="{x:Bind Name}"
AllowDrop="True"
CanDrag="False"
DragOver="TreeViewItem_DragOver"
DragLeave="TreeViewItem_DragLeave"
Drop="TreeViewItem_Drop"
Height="50"
Width="300"/>
</DataTemplate>
</local:TreeViewTemplateSelector.MemberTemplate>
</local:TreeViewTemplateSelector>
</Grid.Resources>
<TreeView
ItemTemplateSelector="{StaticResource TreeViewTemplateSelector}"
ItemsSource="{x:Bind GroupsItemSource}"
SelectionMode="None"
AllowDrop="False"
CanDragItems="False"
CanReorderItems="False"
Width="200">
<TreeView.ItemContainerStyle>
<Style TargetType="TreeViewItem">
<Setter Property="IsExpanded" Value="True"/>
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
</Grid>
</StackPanel>
</Window>