mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-10 17:29:08 +00:00
133 lines
6.9 KiB
XML
133 lines
6.9 KiB
XML
<UserControl x:Class="QuickLook.Plugin.ArchiveViewer.ArchiveFileListView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:local="clr-namespace:QuickLook.Plugin.ArchiveViewer"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
d:DesignHeight="300"
|
|
d:DesignWidth="300"
|
|
mc:Ignorable="d">
|
|
<Grid x:Name="treeGrid" Grid.IsSharedSizeScope="True">
|
|
<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:LevelToIndentConverter x:Key="LevelToIndentConverter" />
|
|
<local:BooleanToAsteriskConverter x:Key="BooleanToAsteriskConverter" />
|
|
<local:SizePrettyPrintConverter x:Key="SizePrettyPrintConverter" />
|
|
<local:DatePrintConverter x:Key="DatePrintConverter" />
|
|
<local:FileExtToIconConverter x:Key="FileExtToIconConverter" />
|
|
<local:LevelToBooleanConverter x:Key="LevelToBooleanConverter" />
|
|
|
|
<!-- Template for directory information at all levels -->
|
|
<HierarchicalDataTemplate DataType="{x:Type local:ArchiveFileEntry}" ItemsSource="{Binding Children.Keys}">
|
|
<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 FileExtToIconConverter}">
|
|
<Binding Path="Name" />
|
|
<Binding Path="IsFolder" />
|
|
</MultiBinding>
|
|
</Image.Source>
|
|
</Image>
|
|
<TextBlock Text="{Binding Name}" />
|
|
<TextBlock Text="{Binding Encrypted, Converter={StaticResource BooleanToAsteriskConverter}}" />
|
|
</StackPanel>
|
|
<Rectangle Grid.Column="1">
|
|
<Rectangle.Width>
|
|
<MultiBinding Converter="{StaticResource LevelToIndentConverter}">
|
|
<Binding Path="Level" />
|
|
<Binding ElementName="treeViewItemToMeasure" Path="ActualWidth" />
|
|
</MultiBinding>
|
|
</Rectangle.Width>
|
|
</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 Background="Transparent"
|
|
BorderThickness="0"
|
|
Focusable="False"
|
|
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.Header>
|
|
<TreeViewItem x:Name="treeViewItemToMeasure" Padding="0" />
|
|
</TreeViewItem.Header>
|
|
|
|
<!--
|
|
Set the width of Column 1 to the same width as the top level
|
|
in the data
|
|
-->
|
|
<TreeViewItem.Width>
|
|
<MultiBinding Converter="{StaticResource LevelToIndentConverter}">
|
|
<Binding Path="Level" />
|
|
<Binding ElementName="treeViewItemToMeasure" Path="ActualWidth" />
|
|
</MultiBinding>
|
|
</TreeViewItem.Width>
|
|
</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 x:Name="treeView"
|
|
Grid.Row="1"
|
|
ItemsSource="{Binding}" />
|
|
</Grid>
|
|
</UserControl> |