Show filtered items in flyout and tooltip
ADD
WalletWasabi.Fluent/Controls/LabelsItemsPresenter.cs
+using System.Collections.Generic;
+using System.Linq;
+using Avalonia.Controls;
+using Avalonia.Controls.Presenters;
+using Avalonia.Styling;
+using ReactiveUI;
+
+namespace WalletWasabi.Fluent.Controls;
+
+public class LabelsItemsPresenter : ItemsPresenter, IStyleable
+{
+ Type IStyleable.StyleKey => typeof(ItemsPresenter);
+
+ protected override void PanelCreated(IPanel panel)
+ {
+ base.PanelCreated(panel);
+
+ if (panel is LabelsPanel labelsPanel)
+ {
+ labelsPanel.WhenAnyValue(x => x.VisibleItemsCount)
+ .Subscribe(x =>
+ {
+ if (Items is List<string> items)
+ {
+ labelsPanel.FilteredItems = items.Skip(x).ToList();
+ }
+ else
+ {
+ labelsPanel.FilteredItems = new List<string>();
+ }
+ });
+ }
+ }
+}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/Controls/LabelsListBox.axaml
WalletWasabi.Fluent/Controls/LabelsListBox.axaml
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Disabled"
AllowAutoHide="False">
- <ItemsPresenter Name="PART_ItemsPresenter"
+ <c:LabelsItemsPresenter Name="PART_ItemsPresenter"
Items="{TemplateBinding Items}"
Margin="0"
VirtualizationMode="Simple">
<Button.Flyout>
<Flyout Placement="BottomEdgeAlignedLeft" ShowMode="TransientWithDismissOnPointerMoveAway">
<c:TagsBox IsReadOnly="True"
- Items="{Binding FilteredLabel}" />
+ Items="{Binding $parent[c:LabelsPanel].FilteredItems}" />
</Flyout>
</Button.Flyout>
<ToolTip.Tip>
<Panel>
<c:TagsBox IsReadOnly="True"
Margin="4,6,0,0"
- Items="{Binding FilteredLabel}" />
+ Items="{Binding $parent[c:LabelsPanel].FilteredItems}" />
</Panel>
</ToolTip.Tip>
</Button>
</c:LabelsPanel>
</ItemsPanelTemplate>
</ItemsPresenter.ItemsPanel>
- </ItemsPresenter>
+ </c:LabelsItemsPresenter>
</ScrollViewer>
</ControlTemplate>
</Setter>

MODIFY
WalletWasabi.Fluent/Controls/LabelsPanel.cs
WalletWasabi.Fluent/Controls/LabelsPanel.cs
+using System.Collections.Generic;
using Avalonia;
using Avalonia.Controls;
@@ -27,6 +28,8 @@ public class LabelsPanel : VirtualizingStackPanel
private set => SetAndRaise(VisibleItemsCountProperty, ref _visibleItemsCount, value);
}
+ public List<string>? FilteredItems { get; set; }
+
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
if (EllipsisControl is { } ellipsisControl)

Show filtered items in flyout and tooltip