|
| 1 | +<UserControl xmlns="https://github.com/avaloniaui" |
| 2 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 4 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 5 | + xmlns:vm="using:SourceGit.ViewModels" |
| 6 | + xmlns:v="using:SourceGit.Views" |
| 7 | + xmlns:c="using:SourceGit.Converters" |
| 8 | + mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" |
| 9 | + x:Class="SourceGit.Views.OpenFileCommandPalette" |
| 10 | + x:DataType="vm:OpenFileCommandPalette"> |
| 11 | + <Grid RowDefinitions="Auto,Auto"> |
| 12 | + <v:RepositoryCommandPaletteTextBox Grid.Row="0" |
| 13 | + x:Name="FilterTextBox" |
| 14 | + Height="24" |
| 15 | + Margin="4,8,4,0" |
| 16 | + BorderThickness="1" |
| 17 | + CornerRadius="12" |
| 18 | + Text="{Binding Filter, Mode=TwoWay}" |
| 19 | + BorderBrush="{DynamicResource Brush.Border2}" |
| 20 | + VerticalContentAlignment="Center"> |
| 21 | + <TextBox.InnerLeftContent> |
| 22 | + <StackPanel Orientation="Horizontal"> |
| 23 | + <Path Width="14" Height="14" |
| 24 | + Margin="6,0,0,0" |
| 25 | + Fill="{DynamicResource Brush.FG2}" |
| 26 | + Data="{StaticResource Icons.Search}"/> |
| 27 | + <Border BorderThickness="0" |
| 28 | + Background="{DynamicResource Brush.Badge}" |
| 29 | + Height="18" |
| 30 | + CornerRadius="4" |
| 31 | + Margin="4,0,0,0" Padding="4,0"> |
| 32 | + <TextBlock Text="{DynamicResource Text.OpenFile}" |
| 33 | + Foreground="Black" |
| 34 | + FontWeight="Bold"/> |
| 35 | + </Border> |
| 36 | + </StackPanel> |
| 37 | + </TextBox.InnerLeftContent> |
| 38 | + |
| 39 | + <TextBox.InnerRightContent> |
| 40 | + <Button Classes="icon_button" |
| 41 | + Width="16" |
| 42 | + Margin="0,0,6,0" |
| 43 | + Command="{Binding ClearFilter}" |
| 44 | + IsVisible="{Binding Filter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" |
| 45 | + HorizontalAlignment="Right"> |
| 46 | + <Path Width="14" Height="14" |
| 47 | + Margin="0,1,0,0" |
| 48 | + Fill="{DynamicResource Brush.FG1}" |
| 49 | + Data="{StaticResource Icons.Clear}"/> |
| 50 | + </Button> |
| 51 | + </TextBox.InnerRightContent> |
| 52 | + </v:RepositoryCommandPaletteTextBox> |
| 53 | + |
| 54 | + <ListBox Grid.Row="1" |
| 55 | + x:Name="FileListBox" |
| 56 | + MaxHeight="250" |
| 57 | + Margin="4,8,4,0" |
| 58 | + BorderThickness="0" |
| 59 | + SelectionMode="Single" |
| 60 | + Background="Transparent" |
| 61 | + Focusable="True" |
| 62 | + ScrollViewer.HorizontalScrollBarVisibility="Disabled" |
| 63 | + ScrollViewer.VerticalScrollBarVisibility="Auto" |
| 64 | + ItemsSource="{Binding VisibleFiles, Mode=OneWay}" |
| 65 | + SelectedItem="{Binding SelectedFile, Mode=TwoWay}" |
| 66 | + IsVisible="{Binding VisibleFiles, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}"> |
| 67 | + <ListBox.Styles> |
| 68 | + <Style Selector="ListBoxItem"> |
| 69 | + <Setter Property="Padding" Value="8,0"/> |
| 70 | + <Setter Property="MinHeight" Value="26"/> |
| 71 | + <Setter Property="CornerRadius" Value="4"/> |
| 72 | + </Style> |
| 73 | + |
| 74 | + <Style Selector="ListBox"> |
| 75 | + <Setter Property="FocusAdorner"> |
| 76 | + <FocusAdornerTemplate> |
| 77 | + <Grid/> |
| 78 | + </FocusAdornerTemplate> |
| 79 | + </Setter> |
| 80 | + </Style> |
| 81 | + </ListBox.Styles> |
| 82 | + |
| 83 | + <ListBox.ItemsPanel> |
| 84 | + <ItemsPanelTemplate> |
| 85 | + <VirtualizingStackPanel Orientation="Vertical"/> |
| 86 | + </ItemsPanelTemplate> |
| 87 | + </ListBox.ItemsPanel> |
| 88 | + |
| 89 | + <ListBox.ItemTemplate> |
| 90 | + <DataTemplate DataType="x:String"> |
| 91 | + <Grid ColumnDefinitions="Auto,*" Background="Transparent" Tapped="OnItemTapped"> |
| 92 | + <Path Grid.Column="0" |
| 93 | + Width="12" Height="12" |
| 94 | + Data="{StaticResource Icons.File}" |
| 95 | + IsHitTestVisible="False"/> |
| 96 | + <TextBlock Grid.Column="1" |
| 97 | + Margin="4,0,0,0" |
| 98 | + VerticalAlignment="Center" |
| 99 | + IsHitTestVisible="False"> |
| 100 | + <Run Text="{Binding Converter={x:Static c:PathConverters.PureFileName}, Mode=OneWay}"/> |
| 101 | + <Run Text=" "/> |
| 102 | + <Run Text="{Binding Converter={x:Static c:PathConverters.PureDirectoryName}, Mode=OneWay}" Foreground="{DynamicResource Brush.FG2}"/> |
| 103 | + </TextBlock> |
| 104 | + </Grid> |
| 105 | + </DataTemplate> |
| 106 | + </ListBox.ItemTemplate> |
| 107 | + </ListBox> |
| 108 | + |
| 109 | + <v:LoadingIcon Grid.Row="1" |
| 110 | + Width="48" Height="48" |
| 111 | + Margin="0,12,0,8" |
| 112 | + HorizontalAlignment="Center" VerticalAlignment="Center" |
| 113 | + IsVisible="{Binding IsLoading}"/> |
| 114 | + </Grid> |
| 115 | +</UserControl> |
0 commit comments