-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathFileListView.xaml
More file actions
116 lines (109 loc) · 5.91 KB
/
Copy pathFileListView.xaml
File metadata and controls
116 lines (109 loc) · 5.91 KB
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
110
111
112
113
114
115
116
<UserControl x:Class="QuickLook.Plugin.FolderViewer.FileListView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:QuickLook.Plugin.FolderViewer"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid Grid.IsSharedSizeScope="True"
x:Name="treeGrid">
<Grid.RowDefinitions>
<!-- Header row -->
<RowDefinition Height="Auto" />
<!-- Row for data -->
<RowDefinition />
</Grid.RowDefinitions>
<Grid.Resources>
<!-- Converts the level in the tree to the width of the spacer column -->
<local:SizePrettyPrintConverter x:Key="SizePrettyPrintConverter" />
<local:DatePrintConverter x:Key="DatePrintConverter" />
<local:FileToIconConverter x:Key="FileToIconConverter" />
<!-- Template for directory information at all levels -->
<HierarchicalDataTemplate ItemsSource="{Binding Children.Keys}"
DataType="{x:Type local:FileEntry}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2" />
<RowDefinition />
<RowDefinition Height="2" />
</Grid.RowDefinitions>
<Grid Grid.Row="1" ShowGridLines="False">
<!-- All column widths are shared except for column 1 which is sized
to compensate for different indentation at each level -->
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="300" SharedSizeGroup="rowHeaderColumn" />
<ColumnDefinition />
<ColumnDefinition MinWidth="100" SharedSizeGroup="column1" />
<ColumnDefinition MinWidth="100" SharedSizeGroup="column2" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Image Width="16" Height="16">
<Image.Source>
<MultiBinding Converter="{StaticResource FileToIconConverter}">
<Binding Path="FullPath" />
</MultiBinding>
</Image.Source>
</Image>
<TextBlock Text="{Binding Name}" />
</StackPanel>
<Rectangle Grid.Column="1">
</Rectangle>
<TextBlock Grid.Column="2">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource SizePrettyPrintConverter}">
<Binding Path="Size" />
<Binding Path="IsFolder" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<TextBlock Grid.Column="3">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource DatePrintConverter}">
<Binding Path="ModifiedDate" />
<Binding Path="IsFolder" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</Grid>
</Grid>
</HierarchicalDataTemplate>
</Grid.Resources>
<!-- Tree view with one item for the header row -->
<TreeView BorderThickness="0" Focusable="False" Background="Transparent"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<TreeViewItem Focusable="False" Visibility="Collapsed">
<TreeViewItem.Header>
<Grid ShowGridLines="False">
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="rowHeaderColumn" />
<ColumnDefinition />
<ColumnDefinition SharedSizeGroup="column1" />
<ColumnDefinition SharedSizeGroup="column2" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text=" " />
<TreeViewItem Grid.Column="1">
</TreeViewItem>
<TextBlock Grid.Column="2"
Text="Original Size" />
<TextBlock Grid.Column="3"
Text="Modified Date" />
</Grid>
</TreeViewItem.Header>
</TreeViewItem>
</TreeView>
<!-- Tree view that will display hierarchical data rows -->
<TreeView Grid.Row="1"
x:Name="treeView"
BorderThickness="0" Background="Transparent" Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=local:FileListView}}"
ItemsSource="{Binding}">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource AncestorType=TreeView}}" />
<EventSetter Event="MouseDoubleClick" Handler="OnItemMouseDoubleClick" />
</Style>
</TreeView.ItemContainerStyle>
</TreeView>
</Grid>
</UserControl>