Files
LanMountainDesktop/LanMountainDesktop/Views/Components/FileManagerWidget.axaml
2026-04-04 03:28:51 +08:00

139 lines
6.1 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
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:fi="using:FluentIcons.Avalonia"
mc:Ignorable="d"
d:DesignWidth="320"
d:DesignHeight="320"
x:Class="LanMountainDesktop.Views.Components.FileManagerWidget">
<Border x:Name="RootBorder"
Background="{DynamicResource AdaptiveSurfaceRaisedBrush}"
BorderBrush="{DynamicResource AdaptiveButtonBorderBrush}"
BorderThickness="1"
CornerRadius="{DynamicResource DesignCornerRadiusComponent}"
Padding="12,10"
ClipToBounds="True">
<Grid RowDefinitions="Auto,Auto,*">
<!-- 导航栏 -->
<Grid Grid.Row="0"
ColumnDefinitions="Auto,Auto,*,Auto"
ColumnSpacing="6">
<!-- 返回按钮 -->
<Button x:Name="BackButton"
Grid.Column="0"
Width="32"
Height="32"
Padding="0"
CornerRadius="16"
Background="{DynamicResource AdaptiveSurfaceOverlayBrush}"
BorderThickness="0"
Click="OnBackButtonClick">
<fi:SymbolIcon Symbol="ArrowLeft"
FontSize="14"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}" />
</Button>
<!-- 主页/盘符按钮 -->
<Button x:Name="HomeButton"
Grid.Column="1"
Width="32"
Height="32"
Padding="0"
CornerRadius="16"
Background="{DynamicResource AdaptiveSurfaceOverlayBrush}"
BorderThickness="0"
Click="OnHomeButtonClick">
<fi:SymbolIcon Symbol="Home"
FontSize="14"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}" />
</Button>
<!-- 路径显示 -->
<Border Grid.Column="2"
Background="{DynamicResource AdaptiveSurfaceOverlayBrush}"
CornerRadius="{DynamicResource DesignCornerRadiusSm}"
Padding="10,0"
VerticalAlignment="Center"
Height="32">
<TextBlock x:Name="PathTextBlock"
VerticalAlignment="Center"
FontSize="13"
FontWeight="Medium"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
TextTrimming="CharacterEllipsis"
ToolTip.Tip="{Binding $self.Text}"
Text="此电脑" />
</Border>
<!-- 刷新按钮 -->
<Button x:Name="RefreshButton"
Grid.Column="3"
Width="32"
Height="32"
Padding="0"
CornerRadius="16"
Background="{DynamicResource AdaptiveSurfaceOverlayBrush}"
BorderThickness="0"
Click="OnRefreshButtonClick">
<fi:SymbolIcon Symbol="ArrowSync"
FontSize="14"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}" />
</Button>
</Grid>
<!-- 分隔线 -->
<Border Grid.Row="1"
Height="1"
Margin="0,10"
Background="{DynamicResource AdaptiveDividerBrush}" />
<!-- 文件列表 -->
<ScrollViewer Grid.Row="2"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto">
<ItemsControl x:Name="FileItemsControl">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</ScrollViewer>
<!-- 空状态 -->
<StackPanel x:Name="EmptyStatePanel"
Grid.Row="2"
IsVisible="False"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="8">
<fi:SymbolIcon Symbol="FolderOpen"
FontSize="40"
Foreground="{DynamicResource AdaptiveTextMutedBrush}" />
<TextBlock x:Name="EmptyStateTextBlock"
Text="文件夹为空"
FontSize="13"
Foreground="{DynamicResource AdaptiveTextMutedBrush}" />
</StackPanel>
<!-- 错误状态 -->
<StackPanel x:Name="ErrorStatePanel"
Grid.Row="2"
IsVisible="False"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="8">
<fi:SymbolIcon Symbol="ErrorCircle"
FontSize="40"
Foreground="{DynamicResource AdaptiveErrorBrush}" />
<TextBlock x:Name="ErrorStateTextBlock"
Text="无法访问此文件夹"
FontSize="13"
Foreground="{DynamicResource AdaptiveErrorBrush}" />
</StackPanel>
</Grid>
</Border>
</UserControl>