feat: update click behavior.

This commit is contained in:
rabbitism
2024-04-11 23:47:36 +08:00
parent 40c1d96f2e
commit edf0e387cc
4 changed files with 39 additions and 12 deletions

View File

@@ -3,6 +3,7 @@ using Avalonia.Controls;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.LogicalTree;
using Avalonia.Media;
using Avalonia.Media.TextFormatting;
@@ -47,9 +48,9 @@ public class TreeComboBoxItem: HeaderedItemsControl, ISelectable
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
base.OnApplyTemplate(e);
DoubleTappedEvent.RemoveHandler(OnDoubleTapped, _header);
DoubleTappedEvent.RemoveHandler(OnDoubleTapped, this);
_header = e.NameScope.Find<Control>(PartNames.PART_Header);
DoubleTappedEvent.AddHandler(OnDoubleTapped, _header);
DoubleTappedEvent.AddHandler(OnDoubleTapped, RoutingStrategies.Tunnel, true, this);
}
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)