Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Languages/lang_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@
"Toggle navigation panel": "Toggle navigation panel",
"Minimize": "Minimize",
"Maximize": "Maximize",
"Clear search": "Clear search",
"UniGetUI by Devolutions": "UniGetUI by Devolutions",
"UniGetUI is an application that makes managing your software easier, by providing an all-in-one graphical interface for your command-line package managers.": "UniGetUI is an application that makes managing your software easier, by providing an all-in-one graphical interface for your command-line package managers.",
"Useful links": "Useful links",
Expand Down
23 changes: 22 additions & 1 deletion src/UniGetUI.Avalonia/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@
CornerRadius="0"
BorderThickness="0"
VerticalContentAlignment="Center"
Padding="12,0,4,0"
Padding="12,0,30,0"
Background="Transparent"
PlaceholderForeground="{DynamicResource SearchBoxPlaceholderForeground}"
PlaceholderText="{Binding GlobalSearchPlaceholder}"
Expand All @@ -527,6 +527,27 @@
<x:Double x:Key="TextControlPlaceholderOpacity">1</x:Double>
</TextBox.Resources>
</TextBox>
<!-- Clear (✕): overlays the right edge of the text column, shown only when
the box has text; the TextBox's right padding reserves room for it. -->
<Button Grid.Column="0"
x:Name="ClearSearchButton"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Width="24"
Height="24"
Margin="0,0,3,3"
Padding="0"
CornerRadius="4"
BorderThickness="0"
Background="Transparent"
IsVisible="{Binding GlobalSearchText, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
automation:AutomationProperties.Name="{t:Translate Clear search}"
ToolTip.Tip="{t:Translate Clear search}"
Comment thread
GabrielDuf marked this conversation as resolved.
Click="ClearSearchBox_Click">
<controls:SvgIcon Path="avares://UniGetUI/Assets/Symbols/cross.svg"
Width="12"
Height="12"/>
</Button>
<Button Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Expand Down
6 changes: 6 additions & 0 deletions src/UniGetUI.Avalonia/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,12 @@ private void SearchBox_KeyDown(object? sender, KeyEventArgs e)
}
}

private void ClearSearchBox_Click(object? sender, RoutedEventArgs e)
{
ViewModel.GlobalSearchText = "";
GlobalSearchBox.Focus();
}

private void SuggestionsList_Tapped(object? sender, TappedEventArgs e)
{
if (SuggestionsList.SelectedItem is SettingsSearchResult result)
Expand Down
Loading