73 lines
3.1 KiB
XML
73 lines
3.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Page
|
|
x:Class="winui_learning_3.Views.HomePage"
|
|
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:models="using:winui_learning_3.Models"
|
|
mc:Ignorable="d">
|
|
|
|
<Page.Resources>
|
|
<!-- Tree node: a folder -->
|
|
<DataTemplate x:Key="FolderNodeTemplate" x:DataType="models:FolderContentDto">
|
|
<TreeViewItem ItemsSource="{x:Bind Children}"
|
|
Content="{x:Bind Name}"
|
|
HasUnrealizedChildren="True" />
|
|
</DataTemplate>
|
|
|
|
<!-- Right side: a file row -->
|
|
<DataTemplate x:Key="FileTemplate" x:DataType="models:FileDto">
|
|
<Grid Padding="0,10" ColumnSpacing="12">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<FontIcon Glyph="" FontSize="16" />
|
|
<TextBlock Grid.Column="1" Text="{x:Bind Name}"
|
|
TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
|
|
<TextBlock Grid.Column="2" Text="{x:Bind Extension}"
|
|
Opacity="0.6" VerticalAlignment="Center" />
|
|
</Grid>
|
|
</DataTemplate>
|
|
</Page.Resources>
|
|
|
|
<Grid ColumnSpacing="0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="280" MinWidth="160" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- LEFT: drives + folders -->
|
|
<Border BorderBrush="{ThemeResource DividerStrokeColorDefaultBrush}"
|
|
BorderThickness="0,0,1,0">
|
|
<TreeView x:Name="FolderTree"
|
|
ItemTemplate="{StaticResource FolderNodeTemplate}"
|
|
SelectionMode="Single"
|
|
Expanding="FolderTree_Expanding"
|
|
ItemInvoked="FolderTree_ItemInvoked" />
|
|
</Border>
|
|
|
|
<!-- RIGHT: path bar + content -->
|
|
<Grid Grid.Column="1" RowSpacing="8" Padding="12">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<AutoSuggestBox x:Name="PathBox"
|
|
PlaceholderText="Type a path, e.g. C:\Users"
|
|
QueryIcon="Forward"
|
|
GotFocus="PathBox_GotFocus"
|
|
TextChanged="PathBox_TextChanged"
|
|
SuggestionChosen="PathBox_SuggestionChosen"
|
|
QuerySubmitted="PathBox_QuerySubmitted" />
|
|
|
|
<ListView x:Name="FileList" Grid.Row="1"
|
|
ItemTemplate="{StaticResource FileTemplate}"
|
|
SelectionMode="Single" />
|
|
</Grid>
|
|
</Grid>
|
|
</Page> |