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
22 changes: 22 additions & 0 deletions src/UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,28 @@
<Setter Property="Foreground" Value="{DynamicResource TextOnAccentFillColorDisabledBrush}"/>
</Style>

<!-- The old WinUI source actions were HyperlinkButtons. Keep their border transparent
in every state and use subtle hover/pressed fills instead of generic Button chrome. -->
<Style Selector="Button.filter-hyperlink">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource AccentTextFillColorPrimaryBrush}"/>
</Style>
<Style Selector="Button.filter-hyperlink:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SubtleFillColorSecondaryBrush}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource AccentTextFillColorSecondaryBrush}"/>
</Style>
<Style Selector="Button.filter-hyperlink:pressed">
<Setter Property="RenderTransform" Value="none"/>
</Style>
<Style Selector="Button.filter-hyperlink:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SubtleFillColorTertiaryBrush}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource AccentTextFillColorTertiaryBrush}"/>
</Style>

<!-- Standard non-accent action button. Keep this semantic style separate from the
framework's default Button so icon, toolbar, dialog, and accent buttons retain
their purpose-specific appearances. Reusable controls such as ButtonCard opt in
Expand Down
70 changes: 61 additions & 9 deletions src/UniGetUI.Avalonia/Views/Controls/SearchSourceSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,28 @@ protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)

private Control BuildFlyoutContent()
{
var panel = new StackPanel { Spacing = 2, MinWidth = 200 };
panel.Children.Add(new TextBlock
var root = new StackPanel { Spacing = 6, MinWidth = 220 };
root.Children.Add(new TextBlock
{
Text = CoreTools.Translate("Search these package managers"),
FontSize = 12,
Opacity = 0.7,
Margin = new Thickness(0, 0, 0, 6),
});

var managers = _loader.GetSearchableManagers();
if (managers.Count == 0)
{
panel.Children.Add(new TextBlock
root.Children.Add(new TextBlock
{
Text = CoreTools.Translate("No package managers are available"),
Opacity = 0.7,
});
return panel;
return root;
}

var boxes = new List<CheckBox>();
var list = new StackPanel { Spacing = 2 };

foreach (IPackageManager manager in managers)
{
var box = new CheckBox
Expand All @@ -124,15 +126,65 @@ private Control BuildFlyoutContent()
_selectionChanged = true;
RefreshSummary();
};
panel.Children.Add(box);
boxes.Add(box);
list.Children.Add(box);
}

return new ScrollViewer
root.Children.Add(BuildBulkActions(boxes));
root.Children.Add(new ScrollViewer
{
MaxHeight = 360,
MaxHeight = 320,
HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
Content = panel,
Content = list,
});

return root;
}

private static Control BuildBulkActions(List<CheckBox> boxes)
{
var grid = new Grid
{
ColumnDefinitions = new ColumnDefinitions("*,*"),
ColumnSpacing = 4,
};

var selectAll = BuildLinkButton(CoreTools.Translate("Select all"), () => SetAll(boxes, true));
var clear = BuildLinkButton(CoreTools.Translate("Clear selection"), () => SetAll(boxes, false));

Grid.SetColumn(selectAll, 0);
Grid.SetColumn(clear, 1);
grid.Children.Add(selectAll);
grid.Children.Add(clear);
return grid;
}

private static Button BuildLinkButton(string label, Action onClick)
{
var button = new Button
{
Classes = { "filter-hyperlink" },
Padding = new Thickness(2),
HorizontalAlignment = HorizontalAlignment.Stretch,
HorizontalContentAlignment = HorizontalAlignment.Center,
Content = new TextBlock
{
Text = label,
FontSize = 12,
FontWeight = FontWeight.SemiBold,
TextAlignment = TextAlignment.Center,
TextWrapping = TextWrapping.Wrap,
},
};
AutomationProperties.SetName(button, label);
button.Click += (_, _) => onClick();
return button;
}

private static void SetAll(List<CheckBox> boxes, bool selected)
{
foreach (CheckBox box in boxes)
box.IsChecked = selected;
}

private void RefreshSummary()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,6 @@
<Style Selector="RadioButton.filter-radio /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="TextWrapping" Value="Wrap"/>
</Style>
<!-- The old WinUI source actions were HyperlinkButtons. Keep their border transparent
in every state and use subtle hover/pressed fills instead of generic Button chrome. -->
<Style Selector="Button.filter-hyperlink">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Foreground" Value="{DynamicResource AccentTextFillColorPrimaryBrush}"/>
</Style>
<Style Selector="Button.filter-hyperlink:pointerover /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SubtleFillColorSecondaryBrush}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource AccentTextFillColorSecondaryBrush}"/>
</Style>
<Style Selector="Button.filter-hyperlink:pressed">
<Setter Property="RenderTransform" Value="none"/>
</Style>
<Style Selector="Button.filter-hyperlink:pressed /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Background" Value="{DynamicResource SubtleFillColorTertiaryBrush}"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource AccentTextFillColorTertiaryBrush}"/>
</Style>
<!-- Toolbar buttons: flat, no background/border in normal state (WinUI AppBarButton style) -->
<Style Selector="#ToolbarRow Button">
<Setter Property="Background" Value="Transparent"/>
Expand Down
Loading