|
| 1 | +<!-- |
| 2 | + Files Toolbar — ported from Files App src/Files.App/UserControls/Toolbar.xaml |
| 3 | + (Copyright (c) 2018 - present Files Community, MIT License; see THIRD-PARTY-NOTICES.md). |
| 4 | +
|
| 5 | + Files' Toolbar is a two-column card: a left-aligned CommandBar holding the context |
| 6 | + commands (Cut / Copy / Paste / Rename / Delete / ...), and a right-aligned CommandBar |
| 7 | + holding the view commands (Filter / Arrangement / Layout / Preview pane), all of them |
| 8 | + AppBarButtons with DefaultLabelPosition="Right". |
| 9 | +
|
| 10 | + WinUI -> Avalonia mapping: |
| 11 | + CommandBar -> StackPanel with the CommandBar's 4,0,0,0 padding and 48px row |
| 12 | + AppBarButton -> win:WinAppBarButton (ported from AppBarButton_themeresources.xaml) |
| 13 | + Border 8px card -> kept verbatim: CornerRadius=8, BorderThickness=1, |
| 14 | + CardStrokeColorDefaultBrush, BackgroundSizing=InnerBorderEdge |
| 15 | +
|
| 16 | + Files populates the left CommandBar from its CommandManager in code-behind; FileHub has a |
| 17 | + fixed command set, so the buttons are declared here instead. |
| 18 | +--> |
| 19 | +<UserControl xmlns="https://github.com/avaloniaui" |
| 20 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 21 | + xmlns:win="using:WinUI3.Fluent.Controls" |
| 22 | + xmlns:ui="using:FluentAvalonia.UI.Controls" |
| 23 | + xmlns:loc="using:FileHub.Desktop.Services" |
| 24 | + x:Class="FileHub.Desktop.Views.Controls.FilesToolbar"> |
| 25 | + |
| 26 | + <Border Background="{DynamicResource CardBackgroundFillColorDefaultBrush}" |
| 27 | + BorderBrush="{DynamicResource CardStrokeColorDefaultBrush}" |
| 28 | + BorderThickness="1" |
| 29 | + CornerRadius="{StaticResource OverlayCornerRadius}"> |
| 30 | + <Grid ColumnDefinitions="*,Auto"> |
| 31 | + |
| 32 | + <!-- Context commands (Files: ContextCommandBar) --> |
| 33 | + <StackPanel Grid.Column="0" Orientation="Horizontal" Margin="4,0,0,0"> |
| 34 | + <win:WinAppBarButton Label="{x:Static loc:Strings.LblNew}" |
| 35 | + Command="{Binding NewFolderCommand}" |
| 36 | + ToolTip.Tip="{x:Static loc:Strings.NewFolder}"> |
| 37 | + <win:WinAppBarButton.Icon> |
| 38 | + <ui:FASymbolIcon Symbol="Add" FontSize="16" /> |
| 39 | + </win:WinAppBarButton.Icon> |
| 40 | + </win:WinAppBarButton> |
| 41 | + |
| 42 | + <win:WinAppBarButton Label="{x:Static loc:Strings.LblCut}" |
| 43 | + Command="{Binding CutCommand}" |
| 44 | + ToolTip.Tip="{x:Static loc:Strings.Cut}"> |
| 45 | + <win:WinAppBarButton.Icon> |
| 46 | + <ui:FASymbolIcon Symbol="Cut" FontSize="16" /> |
| 47 | + </win:WinAppBarButton.Icon> |
| 48 | + </win:WinAppBarButton> |
| 49 | + |
| 50 | + <win:WinAppBarButton Label="{x:Static loc:Strings.LblCopy}" |
| 51 | + Command="{Binding CopyCommand}" |
| 52 | + ToolTip.Tip="{x:Static loc:Strings.Copy}"> |
| 53 | + <win:WinAppBarButton.Icon> |
| 54 | + <ui:FASymbolIcon Symbol="Copy" FontSize="16" /> |
| 55 | + </win:WinAppBarButton.Icon> |
| 56 | + </win:WinAppBarButton> |
| 57 | + |
| 58 | + <win:WinAppBarButton Label="{x:Static loc:Strings.LblPaste}" |
| 59 | + Command="{Binding PasteCommand}" |
| 60 | + ToolTip.Tip="{x:Static loc:Strings.Paste}"> |
| 61 | + <win:WinAppBarButton.Icon> |
| 62 | + <ui:FASymbolIcon Symbol="Paste" FontSize="16" /> |
| 63 | + </win:WinAppBarButton.Icon> |
| 64 | + </win:WinAppBarButton> |
| 65 | + |
| 66 | + <win:WinAppBarButton Label="{x:Static loc:Strings.LblRename}" |
| 67 | + Command="{Binding RenameCommand}" |
| 68 | + ToolTip.Tip="{x:Static loc:Strings.Rename}"> |
| 69 | + <win:WinAppBarButton.Icon> |
| 70 | + <ui:FASymbolIcon Symbol="Edit" FontSize="16" /> |
| 71 | + </win:WinAppBarButton.Icon> |
| 72 | + </win:WinAppBarButton> |
| 73 | + |
| 74 | + <win:WinAppBarButton Label="{x:Static loc:Strings.LblDelete}" |
| 75 | + Command="{Binding DeleteCommand}" |
| 76 | + ToolTip.Tip="{x:Static loc:Strings.Delete}"> |
| 77 | + <win:WinAppBarButton.Icon> |
| 78 | + <ui:FASymbolIcon Symbol="Delete" FontSize="16" /> |
| 79 | + </win:WinAppBarButton.Icon> |
| 80 | + </win:WinAppBarButton> |
| 81 | + </StackPanel> |
| 82 | + |
| 83 | + <!-- Base commands (Files: BaseCommandBar, right aligned, labels collapsed) --> |
| 84 | + <StackPanel Grid.Column="1" Orientation="Horizontal" Margin="0,0,4,0"> |
| 85 | + <win:WinAppBarButton LabelPosition="Collapsed" |
| 86 | + Label="{x:Static loc:Strings.LblHidden}" |
| 87 | + Command="{Binding ToggleHiddenCommand}" |
| 88 | + ToolTip.Tip="{x:Static loc:Strings.ToggleHidden}"> |
| 89 | + <win:WinAppBarButton.Icon> |
| 90 | + <ui:FASymbolIcon Symbol="View" FontSize="16" /> |
| 91 | + </win:WinAppBarButton.Icon> |
| 92 | + </win:WinAppBarButton> |
| 93 | + |
| 94 | + <win:WinAppBarButton LabelPosition="Collapsed" |
| 95 | + Label="{x:Static loc:Strings.LblSort}" |
| 96 | + Command="{Binding SetSortCommand}" CommandParameter="Name" |
| 97 | + ToolTip.Tip="{x:Static loc:Strings.Sort}"> |
| 98 | + <win:WinAppBarButton.Icon> |
| 99 | + <ui:FASymbolIcon Symbol="Sort" FontSize="16" /> |
| 100 | + </win:WinAppBarButton.Icon> |
| 101 | + </win:WinAppBarButton> |
| 102 | + |
| 103 | + <win:WinAppBarButton LabelPosition="Collapsed" |
| 104 | + Label="{x:Static loc:Strings.LblLayout}" |
| 105 | + Command="{Binding ToggleViewCommand}" |
| 106 | + ToolTip.Tip="{x:Static loc:Strings.ToggleView}"> |
| 107 | + <win:WinAppBarButton.Icon> |
| 108 | + <ui:FASymbolIcon Symbol="ViewAll" FontSize="16" /> |
| 109 | + </win:WinAppBarButton.Icon> |
| 110 | + </win:WinAppBarButton> |
| 111 | + |
| 112 | + <win:WinAppBarButton LabelPosition="Collapsed" |
| 113 | + Label="{x:Static loc:Strings.LblDetails}" |
| 114 | + Command="{Binding ToggleDetailsPaneCommand}" |
| 115 | + ToolTip.Tip="{x:Static loc:Strings.ToggleDetailsPane}"> |
| 116 | + <win:WinAppBarButton.Icon> |
| 117 | + <ui:FASymbolIcon Symbol="ContactInfo" FontSize="16" /> |
| 118 | + </win:WinAppBarButton.Icon> |
| 119 | + </win:WinAppBarButton> |
| 120 | + </StackPanel> |
| 121 | + </Grid> |
| 122 | + </Border> |
| 123 | +</UserControl> |
0 commit comments