|
7 | 7 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
8 | 8 | xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
|
9 | 9 | MaxHeight="{Binding MaxHeight}"
|
10 |
| - Margin="{Binding Margin}" |
| 10 | + Margin="{DynamicResource ResultMargin}" |
11 | 11 | HorizontalContentAlignment="Stretch"
|
12 | 12 | d:DataContext="{d:DesignInstance vm:ResultsViewModel}"
|
13 | 13 | d:DesignHeight="100"
|
|
17 | 17 | ItemsSource="{Binding Results}"
|
18 | 18 | KeyboardNavigation.DirectionalNavigation="Cycle"
|
19 | 19 | PreviewMouseDown="ListBox_PreviewMouseDown"
|
| 20 | + PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown" |
| 21 | + PreviewMouseLeftButtonUp="ResultListBox_OnPreviewMouseUp" |
| 22 | + PreviewMouseMove="ResultList_MouseMove" |
| 23 | + PreviewMouseRightButtonDown="ResultListBox_OnPreviewMouseRightButtonDown" |
20 | 24 | SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}"
|
21 | 25 | SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
|
22 | 26 | SelectionChanged="OnSelectionChanged"
|
|
25 | 29 | VirtualizingStackPanel.IsVirtualizing="True"
|
26 | 30 | VirtualizingStackPanel.VirtualizationMode="Standard"
|
27 | 31 | Visibility="{Binding Visbility}"
|
28 |
| - mc:Ignorable="d" |
29 |
| - PreviewMouseMove="ResultList_MouseMove" |
30 |
| - PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown" |
31 |
| - PreviewMouseLeftButtonUp="ResultListBox_OnPreviewMouseUp" |
32 |
| - PreviewMouseRightButtonDown="ResultListBox_OnPreviewMouseRightButtonDown"> |
| 32 | + mc:Ignorable="d"> |
33 | 33 | <!-- IsSynchronizedWithCurrentItem: http://stackoverflow.com/a/7833798/2833083 -->
|
34 | 34 |
|
35 | 35 | <ListBox.ItemTemplate>
|
36 | 36 | <DataTemplate>
|
37 |
| - <Button |
38 |
| - HorizontalAlignment="Stretch"> |
| 37 | + <Button HorizontalAlignment="Stretch"> |
39 | 38 | <Button.Template>
|
40 | 39 | <ControlTemplate>
|
41 | 40 | <ContentPresenter Content="{TemplateBinding Button.Content}" />
|
|
56 | 55 | <Grid.ColumnDefinitions>
|
57 | 56 | <ColumnDefinition Width="60" />
|
58 | 57 | <ColumnDefinition Width="9*" />
|
59 |
| - <ColumnDefinition Width="Auto" /> |
| 58 | + <ColumnDefinition Width="Auto" MinWidth="8" /> |
60 | 59 | </Grid.ColumnDefinitions>
|
61 | 60 | <StackPanel
|
62 | 61 | Grid.Column="2"
|
63 | 62 | Margin="0,0,10,0"
|
| 63 | + VerticalAlignment="Center" |
64 | 64 | Visibility="{Binding ShowOpenResultHotkey}">
|
65 | 65 | <TextBlock
|
66 | 66 | x:Name="Hotkey"
|
67 | 67 | Margin="12,0,12,0"
|
68 |
| - Padding="0,10,0,10" |
| 68 | + Padding="0,0,0,0" |
69 | 69 | HorizontalAlignment="Right"
|
70 | 70 | VerticalAlignment="Center"
|
71 |
| - Opacity="0.8" |
72 | 71 | Style="{DynamicResource ItemHotkeyStyle}">
|
73 | 72 | <TextBlock.Visibility>
|
74 | 73 | <Binding Converter="{StaticResource ResourceKey=OpenResultHotkeyVisibilityConverter}" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}" />
|
|
81 | 80 | </TextBlock.Text>
|
82 | 81 | </TextBlock>
|
83 | 82 | </StackPanel>
|
84 |
| - <Border |
85 |
| - Margin="9,0,0,0" |
86 |
| - BorderBrush="Transparent" |
87 |
| - BorderThickness="0"> |
88 |
| - <Image |
89 |
| - x:Name="ImageIcon" |
90 |
| - Width="{Binding IconXY}" |
91 |
| - Height="{Binding IconXY}" |
92 |
| - Margin="0,0,0,0" IsHitTestVisible="False" |
93 |
| - HorizontalAlignment="Center" |
94 |
| - Source="{Binding Image, TargetNullValue={x:Null}}" |
95 |
| - Stretch="Uniform" |
96 |
| - Visibility="{Binding ShowIcon}"> |
97 |
| - <Image.Clip> |
98 |
| - <EllipseGeometry RadiusX="{Binding IconRadius}" RadiusY="{Binding IconRadius}" Center="16 16"/> |
99 |
| - </Image.Clip> |
100 |
| - </Image> |
101 |
| - </Border> |
102 |
| - <Border |
103 |
| - Margin="9,0,0,0" |
104 |
| - BorderBrush="Transparent" |
105 |
| - BorderThickness="0"> |
106 |
| - <TextBlock |
| 83 | + |
| 84 | + <Grid Grid.Column="0"> |
| 85 | + <Grid.ColumnDefinitions> |
| 86 | + <ColumnDefinition Width="Auto" /> |
| 87 | + <ColumnDefinition /> |
| 88 | + </Grid.ColumnDefinitions> |
| 89 | + |
| 90 | + <Border |
| 91 | + x:Name="Bullet" |
107 | 92 | Grid.Column="0"
|
108 |
| - HorizontalAlignment="Center" |
109 |
| - VerticalAlignment="Center" |
110 |
| - FontFamily="{Binding Glyph.FontFamily}" |
111 |
| - Style="{DynamicResource ItemGlyph}" |
112 |
| - Text="{Binding Glyph.Glyph}" |
113 |
| - Visibility="{Binding ShowGlyph}" /> |
114 |
| - </Border> |
| 93 | + Style="{DynamicResource BulletStyle}" /> |
| 94 | + |
| 95 | + <Border |
| 96 | + Grid.Column="1" |
| 97 | + Margin="9,0,0,0" |
| 98 | + BorderBrush="Transparent" |
| 99 | + BorderThickness="1"> |
| 100 | + <Image |
| 101 | + x:Name="ImageIcon" |
| 102 | + Width="{Binding IconXY}" |
| 103 | + Height="{Binding IconXY}" |
| 104 | + Margin="0,0,0,0" |
| 105 | + HorizontalAlignment="Center" |
| 106 | + IsHitTestVisible="False" |
| 107 | + Source="{Binding Image, TargetNullValue={x:Null}}" |
| 108 | + Stretch="Uniform" |
| 109 | + Visibility="{Binding ShowIcon}"> |
| 110 | + <Image.Clip> |
| 111 | + <EllipseGeometry |
| 112 | + Center="16 16" |
| 113 | + RadiusX="{Binding IconRadius}" |
| 114 | + RadiusY="{Binding IconRadius}" /> |
| 115 | + </Image.Clip> |
| 116 | + </Image> |
| 117 | + </Border> |
| 118 | + <Border |
| 119 | + Grid.Column="1" |
| 120 | + Margin="9,0,0,0" |
| 121 | + BorderBrush="Transparent" |
| 122 | + BorderThickness="0"> |
| 123 | + <TextBlock |
| 124 | + x:Name="GlyphIcon" |
| 125 | + HorizontalAlignment="Center" |
| 126 | + VerticalAlignment="Center" |
| 127 | + FontFamily="{Binding Glyph.FontFamily}" |
| 128 | + Style="{DynamicResource ItemGlyph}" |
| 129 | + Text="{Binding Glyph.Glyph}" |
| 130 | + Visibility="{Binding ShowGlyph}" /> |
| 131 | + </Border> |
| 132 | + </Grid> |
| 133 | + |
115 | 134 | <Grid
|
116 | 135 | Grid.Column="1"
|
117 | 136 | Margin="6,0,10,0"
|
118 |
| - HorizontalAlignment="Stretch"> |
| 137 | + HorizontalAlignment="Stretch" |
| 138 | + VerticalAlignment="Center"> |
119 | 139 | <Grid.RowDefinitions>
|
120 |
| - <RowDefinition /> |
| 140 | + <RowDefinition Height="Auto" /> |
121 | 141 | <RowDefinition x:Name="SubTitleRowDefinition" Height="Auto" />
|
122 | 142 | </Grid.RowDefinitions>
|
123 | 143 | <ProgressBar
|
124 | 144 | x:Name="progressbarResult"
|
| 145 | + Grid.Row="0" |
125 | 146 | Foreground="{Binding Result.ProgressBarColor}"
|
126 | 147 | Value="{Binding ResultProgress, Mode=OneWay}">
|
127 | 148 | <ProgressBar.Style>
|
128 |
| - <Style TargetType="ProgressBar" BasedOn="{StaticResource ProgressBarResult}"> |
129 |
| - <Setter Property="Visibility" Value="Visible"/> |
| 149 | + <Style BasedOn="{StaticResource ProgressBarResult}" TargetType="ProgressBar"> |
| 150 | + <Setter Property="Visibility" Value="Visible" /> |
130 | 151 | <Style.Triggers>
|
131 | 152 | <DataTrigger Binding="{Binding Result.ProgressBar}" Value="{x:Null}">
|
132 |
| - <Setter Property="Visibility" Value="Collapsed"/> |
| 153 | + <Setter Property="Visibility" Value="Collapsed" /> |
133 | 154 | </DataTrigger>
|
134 | 155 | </Style.Triggers>
|
135 | 156 | </Style>
|
136 | 157 | </ProgressBar.Style>
|
137 | 158 | </ProgressBar>
|
138 | 159 | <TextBlock
|
139 | 160 | x:Name="Title"
|
| 161 | + Grid.Row="0" |
140 | 162 | VerticalAlignment="Center"
|
141 | 163 | DockPanel.Dock="Left"
|
| 164 | + IsEnabled="False" |
142 | 165 | Style="{DynamicResource ItemTitleStyle}"
|
143 | 166 | Text="{Binding Result.Title}"
|
| 167 | + TextTrimming="CharacterEllipsis" |
144 | 168 | ToolTip="{Binding ShowTitleToolTip}"
|
145 |
| - ToolTipService.ShowOnDisabled="True" |
146 |
| - IsEnabled="False"> |
| 169 | + ToolTipService.ShowOnDisabled="True"> |
147 | 170 | <vm:ResultsViewModel.FormattedText>
|
148 | 171 | <MultiBinding Converter="{StaticResource HighlightTextConverter}">
|
149 | 172 | <Binding Path="Result.Title" />
|
|
155 | 178 | x:Name="SubTitle"
|
156 | 179 | Grid.Row="1"
|
157 | 180 | IsEnabled="False"
|
158 |
| - ToolTipService.ShowOnDisabled="True" |
159 | 181 | Style="{DynamicResource ItemSubTitleStyle}"
|
160 | 182 | Text="{Binding Result.SubTitle}"
|
161 |
| - ToolTip="{Binding ShowSubTitleToolTip}"/> |
| 183 | + TextTrimming="CharacterEllipsis" |
| 184 | + ToolTip="{Binding ShowSubTitleToolTip}" |
| 185 | + ToolTipService.ShowOnDisabled="True" /> |
162 | 186 | </Grid>
|
163 | 187 |
|
164 | 188 | </Grid>
|
|
167 | 191 | <!-- a result item height is 52 including margin -->
|
168 | 192 | <DataTemplate.Triggers>
|
169 | 193 | <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
|
| 194 | + <Setter TargetName="Bullet" Property="Style" Value="{DynamicResource ItemBulletSelectedStyle}" /> |
170 | 195 | <Setter TargetName="Title" Property="Style" Value="{DynamicResource ItemTitleSelectedStyle}" />
|
171 | 196 | <Setter TargetName="SubTitle" Property="Style" Value="{DynamicResource ItemSubTitleSelectedStyle}" />
|
172 | 197 | <Setter TargetName="Hotkey" Property="Style" Value="{DynamicResource ItemHotkeySelectedStyle}" />
|
173 | 198 | <Setter TargetName="ImageIcon" Property="Style" Value="{DynamicResource ItemImageSelectedStyle}" />
|
| 199 | + <Setter TargetName="GlyphIcon" Property="Style" Value="{DynamicResource ItemGlyphSelectedStyle}" /> |
174 | 200 | </DataTrigger>
|
175 | 201 | </DataTemplate.Triggers>
|
176 | 202 | </DataTemplate>
|
|
189 | 215 | <ControlTemplate TargetType="{x:Type ListBoxItem}">
|
190 | 216 | <Border
|
191 | 217 | x:Name="Bd"
|
| 218 | + Margin="{DynamicResource ItemMargin}" |
192 | 219 | Background="{TemplateBinding Background}"
|
193 | 220 | BorderBrush="{TemplateBinding BorderBrush}"
|
| 221 | + CornerRadius="{DynamicResource ItemRadius}" |
194 | 222 | SnapsToDevicePixels="True">
|
195 | 223 | <ContentPresenter
|
196 | 224 | HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
0 commit comments