Skip to content

Commit 1e2daa3

Browse files
committed
ResultListbox: Simplify UI
1 parent a7dfdac commit 1e2daa3

File tree

3 files changed

+61
-73
lines changed

3 files changed

+61
-73
lines changed

Flow.Launcher/ResultListBox.xaml

Lines changed: 57 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -61,86 +61,75 @@
6161
<ColumnDefinition Width="9*" />
6262
<ColumnDefinition Width="Auto" MinWidth="8" />
6363
</Grid.ColumnDefinitions>
64-
<StackPanel
65-
x:Name="HotkeyArea"
64+
<Border
65+
x:Name="HotkeyBG"
6666
Grid.Column="2"
67-
Margin="0 0 10 0"
6867
VerticalAlignment="Center"
69-
Visibility="{Binding Settings.ShowOpenResultHotkey, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}">
70-
<Border x:Name="HotkeyBG" Style="{DynamicResource ItemHotkeyBGStyle}">
71-
<Border.Visibility>
72-
<Binding Converter="{StaticResource ResourceKey=OpenResultHotkeyVisibilityConverter}" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}" />
73-
</Border.Visibility>
74-
<TextBlock
75-
x:Name="Hotkey"
76-
Padding="0 0 0 0"
77-
HorizontalAlignment="Right"
78-
VerticalAlignment="Center"
79-
Style="{DynamicResource ItemHotkeyStyle}">
80-
<TextBlock.Text>
81-
<MultiBinding StringFormat="{}{0}+{1}">
82-
<Binding Mode="OneWay" Path="Settings.OpenResultModifiers" />
83-
<Binding Converter="{StaticResource ResourceKey=OrdinalConverter}" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}" />
84-
</MultiBinding>
85-
</TextBlock.Text>
86-
</TextBlock>
87-
</Border>
88-
</StackPanel>
68+
Style="{DynamicResource ItemHotkeyBGStyle}">
69+
<Border.Visibility>
70+
<Binding Converter="{StaticResource ResourceKey=OpenResultHotkeyVisibilityConverter}" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}" />
71+
</Border.Visibility>
72+
<TextBlock
73+
x:Name="Hotkey"
74+
Padding="0 0 0 0"
75+
HorizontalAlignment="Right"
76+
VerticalAlignment="Center"
77+
Style="{DynamicResource ItemHotkeyStyle}">
78+
<TextBlock.Text>
79+
<MultiBinding StringFormat="{}{0}+{1}">
80+
<Binding Mode="OneWay" Path="Settings.OpenResultModifiers" />
81+
<Binding Converter="{StaticResource ResourceKey=OrdinalConverter}" RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}" />
82+
</MultiBinding>
83+
</TextBlock.Text>
84+
</TextBlock>
85+
</Border>
8986

90-
<Border
87+
<StackPanel
9188
Grid.Column="0"
9289
Margin="9 0 0 0"
93-
BorderBrush="Transparent"
94-
BorderThickness="1">
95-
<Grid>
96-
<Image
97-
x:Name="ImageIcon"
98-
IsHitTestVisible="False"
99-
RenderOptions.BitmapScalingMode="Fant"
100-
Source="{Binding Image, TargetNullValue={x:Null}}"
101-
Stretch="Uniform"
102-
StretchDirection="DownOnly"
103-
Style="{DynamicResource ImageIconStyle}"
104-
Visibility="{Binding ShowIcon}">
105-
<Image.Clip>
106-
<EllipseGeometry Center="{Binding ElementName=ImageIcon, Path=ActualWidth, Converter={StaticResource DiameterToCenterPointConverter}}">
107-
<EllipseGeometry.RadiusX>
108-
<MultiBinding Converter="{StaticResource IconRadiusConverter}">
109-
<Binding ElementName="ImageIcon" Path="ActualWidth" />
110-
<Binding Path="Result.RoundedIcon" />
111-
</MultiBinding>
112-
</EllipseGeometry.RadiusX>
113-
<EllipseGeometry.RadiusY>
114-
<MultiBinding Converter="{StaticResource IconRadiusConverter}">
115-
<Binding ElementName="ImageIcon" Path="ActualWidth" />
116-
<Binding Path="Result.RoundedIcon" />
117-
</MultiBinding>
118-
</EllipseGeometry.RadiusY>
119-
</EllipseGeometry>
120-
</Image.Clip>
121-
</Image>
90+
VerticalAlignment="Center">
91+
<Image
92+
x:Name="ImageIcon"
93+
IsHitTestVisible="False"
94+
RenderOptions.BitmapScalingMode="Fant"
95+
Source="{Binding Image, TargetNullValue={x:Null}}"
96+
Stretch="Uniform"
97+
StretchDirection="DownOnly"
98+
Style="{DynamicResource ImageIconStyle}"
99+
Visibility="{Binding ShowIcon}">
100+
<Image.Clip>
101+
<EllipseGeometry Center="{Binding ElementName=ImageIcon, Path=ActualWidth, Converter={StaticResource DiameterToCenterPointConverter}}">
102+
<EllipseGeometry.RadiusX>
103+
<MultiBinding Converter="{StaticResource IconRadiusConverter}">
104+
<Binding ElementName="ImageIcon" Path="ActualWidth" />
105+
<Binding Path="Result.RoundedIcon" />
106+
</MultiBinding>
107+
</EllipseGeometry.RadiusX>
108+
<EllipseGeometry.RadiusY>
109+
<MultiBinding Converter="{StaticResource IconRadiusConverter}">
110+
<Binding ElementName="ImageIcon" Path="ActualWidth" />
111+
<Binding Path="Result.RoundedIcon" />
112+
</MultiBinding>
113+
</EllipseGeometry.RadiusY>
114+
</EllipseGeometry>
115+
</Image.Clip>
116+
</Image>
122117

123-
<TextBlock
124-
x:Name="GlyphIcon"
125-
FontFamily="{Binding Glyph.FontFamily}"
126-
Style="{DynamicResource ItemGlyph}"
127-
Text="{Binding Glyph.Glyph}"
128-
Visibility="{Binding ShowGlyph}" />
129-
</Grid>
130-
</Border>
118+
<TextBlock
119+
x:Name="GlyphIcon"
120+
FontFamily="{Binding Glyph.FontFamily}"
121+
Style="{DynamicResource ItemGlyph}"
122+
Text="{Binding Glyph.Glyph}"
123+
Visibility="{Binding ShowGlyph}" />
124+
</StackPanel>
131125

132-
<Grid
126+
<StackPanel
133127
Grid.Column="1"
134128
Margin="6 0 10 0"
135129
HorizontalAlignment="Stretch"
136130
VerticalAlignment="Center">
137-
<Grid.RowDefinitions>
138-
<RowDefinition Height="Auto" />
139-
<RowDefinition x:Name="SubTitleRowDefinition" Height="Auto" />
140-
</Grid.RowDefinitions>
141131
<TextBlock
142132
x:Name="Title"
143-
Grid.Row="0"
144133
DockPanel.Dock="Left"
145134
FontSize="{Binding Settings.ResultItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
146135
IsEnabled="False"
@@ -158,15 +147,14 @@
158147
</TextBlock>
159148
<TextBlock
160149
x:Name="SubTitle"
161-
Grid.Row="1"
162150
FontSize="{Binding Settings.ResultSubItemFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
163151
IsEnabled="False"
164152
Style="{DynamicResource ItemSubTitleStyle}"
165153
Text="{Binding Result.SubTitle}"
166154
TextTrimming="CharacterEllipsis"
167155
ToolTip="{Binding ShowSubTitleToolTip}"
168156
ToolTipService.ShowOnDisabled="True" />
169-
</Grid>
157+
</StackPanel>
170158

171159
</Grid>
172160
</Button.Content>

Flow.Launcher/Themes/Base.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,13 @@
300300
<Setter Property="Foreground" Value="#8f8f8f" />
301301
</Style>
302302
<Style x:Key="BaseItemHotkeyBGStyle" TargetType="{x:Type Border}">
303-
<Setter Property="Margin" Value="12 0 12 0" />
303+
<Setter Property="Margin" Value="12 0 22 0" />
304304
<Setter Property="Padding" Value="6 4 6 4" />
305305
<Setter Property="Background" Value="#138A8A8A" />
306306
<Setter Property="CornerRadius" Value="4" />
307307
</Style>
308308
<Style x:Key="BaseItemHotkeyBGSelectedStyle" TargetType="{x:Type Border}">
309-
<Setter Property="Margin" Value="12 0 12 0" />
309+
<Setter Property="Margin" Value="12 0 22 0" />
310310
<Setter Property="Padding" Value="6 4 6 4" />
311311
<Setter Property="CornerRadius" Value="4" />
312312
<Setter Property="Background" Value="#138A8A8A" />
@@ -315,7 +315,7 @@
315315
x:Key="ItemHotkeyBGStyle"
316316
BasedOn="{StaticResource BaseItemHotkeyBGStyle}"
317317
TargetType="{x:Type Border}">
318-
<Setter Property="Margin" Value="12 0 12 0" />
318+
<Setter Property="Margin" Value="12 0 22 0" />
319319
<Setter Property="Padding" Value="6 4 6 4" />
320320
<Setter Property="CornerRadius" Value="4" />
321321
</Style>

Flow.Launcher/ViewModel/ResultViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public Visibility ShowIcon
8181
if (Settings.UseGlyphIcons && !GlyphAvailable && ImgIconAvailable)
8282
return Visibility.Visible;
8383

84-
return !Settings.UseGlyphIcons && ImgIconAvailable ? Visibility.Visible : Visibility.Hidden;
84+
return !Settings.UseGlyphIcons && ImgIconAvailable ? Visibility.Visible : Visibility.Collapsed;
8585
}
8686
}
8787

0 commit comments

Comments
 (0)