-
Notifications
You must be signed in to change notification settings - Fork 394
Expand file tree
/
Copy pathCompareCommandPalette.axaml
More file actions
139 lines (130 loc) · 5.82 KB
/
CompareCommandPalette.axaml
File metadata and controls
139 lines (130 loc) · 5.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<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:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:v="using:SourceGit.Views"
xmlns:c="using:SourceGit.Converters"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.CompareCommandPalette"
x:DataType="vm:CompareCommandPalette">
<Grid RowDefinitions="Auto,Auto,Auto">
<v:RepositoryCommandPaletteTextBox Grid.Row="0"
x:Name="FilterTextBox"
Height="24"
Margin="4,8,4,0"
BorderThickness="1"
CornerRadius="12"
Text="{Binding Filter, Mode=TwoWay}"
BorderBrush="{DynamicResource Brush.Border2}"
VerticalContentAlignment="Center">
<TextBox.InnerLeftContent>
<StackPanel Orientation="Horizontal">
<Path Width="14" Height="14"
Margin="6,0,0,0"
Fill="{DynamicResource Brush.FG2}"
Data="{StaticResource Icons.Search}"/>
<Border BorderThickness="0"
Background="{DynamicResource Brush.Badge}"
Height="18"
CornerRadius="4"
Margin="4,0,0,0" Padding="4,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{DynamicResource Text.Compare}" Foreground="Black" FontWeight="Bold"/>
<ContentControl Content="{Binding BasedOn}" Margin="4,0,0,0" MaxWidth="100">
<ContentControl.DataTemplates>
<DataTemplate DataType="m:Branch">
<TextBlock Text="{Binding FriendlyName}" Foreground="White" TextTrimming="CharacterEllipsis"/>
</DataTemplate>
<DataTemplate DataType="m:Tag">
<TextBlock Text="{Binding Name}" Foreground="White" TextTrimming="CharacterEllipsis"/>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</StackPanel>
</Border>
</StackPanel>
</TextBox.InnerLeftContent>
<TextBox.InnerRightContent>
<Button Classes="icon_button"
Width="16"
Margin="0,0,6,0"
Command="{Binding ClearFilter}"
IsVisible="{Binding Filter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
HorizontalAlignment="Right">
<Path Width="14" Height="14"
Margin="0,1,0,0"
Fill="{DynamicResource Brush.FG1}"
Data="{StaticResource Icons.Clear}"/>
</Button>
</TextBox.InnerRightContent>
</v:RepositoryCommandPaletteTextBox>
<TextBlock Grid.Row="1"
Margin="6,12,0,0"
Text="{DynamicResource Text.CommandPalette.BranchesAndTags}"
FontWeight="Bold"
Foreground="{DynamicResource Brush.FG2}"/>
<ListBox Grid.Row="2"
x:Name="RefsListBox"
MaxHeight="360"
Margin="4,8"
BorderThickness="0"
SelectionMode="Single"
Background="Transparent"
Focusable="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
ItemsSource="{Binding Refs, Mode=OneWay}"
SelectedItem="{Binding CompareTo, Mode=TwoWay}"
IsVisible="{Binding Refs, Converter={x:Static c:ListConverters.IsNotNullOrEmpty}}">
<ListBox.Styles>
<Style Selector="ListBoxItem">
<Setter Property="Padding" Value="8,0"/>
<Setter Property="MinHeight" Value="26"/>
<Setter Property="CornerRadius" Value="4"/>
</Style>
<Style Selector="ListBox">
<Setter Property="FocusAdorner">
<FocusAdornerTemplate>
<Grid/>
</FocusAdornerTemplate>
</Setter>
</Style>
</ListBox.Styles>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.DataTemplates>
<DataTemplate DataType="m:Branch">
<Grid ColumnDefinitions="Auto,*" Background="Transparent" Tapped="OnItemTapped">
<Path Grid.Column="0"
Width="12" Height="12"
Data="{StaticResource Icons.Branch}"
IsHitTestVisible="False"/>
<TextBlock Grid.Column="1"
Margin="6,0,0,0"
VerticalAlignment="Center"
IsHitTestVisible="False"
Text="{Binding FriendlyName, Mode=OneWay}"/>
</Grid>
</DataTemplate>
<DataTemplate DataType="m:Tag">
<Grid ColumnDefinitions="Auto,*" Background="Transparent" Tapped="OnItemTapped">
<Path Grid.Column="0"
Width="12" Height="12"
Data="{StaticResource Icons.Tag}"
IsHitTestVisible="False"/>
<TextBlock Grid.Column="1"
Margin="6,0,0,0"
VerticalAlignment="Center"
IsHitTestVisible="False"
Text="{Binding Name, Mode=OneWay}"/>
</Grid>
</DataTemplate>
</ListBox.DataTemplates>
</ListBox>
</Grid>
</UserControl>