feat: add separator.

This commit is contained in:
rabbitism
2024-02-14 01:07:22 +08:00
parent 32f5662370
commit f2073f4eb3
4 changed files with 71 additions and 111 deletions

View File

@@ -124,7 +124,15 @@ public class NavMenuItem: HeaderedSelectingItemsControl
get => _level;
set => SetAndRaise(LevelProperty, ref _level, value);
}
public static readonly StyledProperty<bool> IsSeparatorProperty = AvaloniaProperty.Register<NavMenuItem, bool>(
nameof(IsSeparator));
public bool IsSeparator
{
get => GetValue(IsSeparatorProperty);
set => SetValue(IsSeparatorProperty, value);
}
static NavMenuItem()
{
@@ -222,6 +230,11 @@ public class NavMenuItem: HeaderedSelectingItemsControl
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
if (IsSeparator)
{
e.Handled = true;
return;
}
base.OnPointerPressed(e);
if (this.ItemCount == 0)
{