feat: Breadcrumb and its item may support CommandParameter/Binding

This commit is contained in:
Gehongyan
2024-08-21 13:47:29 +08:00
parent 0c17aec5c3
commit 591d53cbd3
2 changed files with 25 additions and 1 deletions

View File

@@ -39,6 +39,15 @@ public class BreadcrumbItem: ContentControl
set => SetValue(CommandProperty, value);
}
public static readonly StyledProperty<object?> CommandParameterProperty = AvaloniaProperty.Register<BreadcrumbItem, object?>(
nameof(CommandParameter));
public object? CommandParameter
{
get => GetValue(CommandParameterProperty);
set => SetValue(CommandParameterProperty, value);
}
public static readonly StyledProperty<IDataTemplate?> IconTemplateProperty = AvaloniaProperty.Register<BreadcrumbItem, IDataTemplate?>(
nameof(IconTemplate));
@@ -62,7 +71,7 @@ public class BreadcrumbItem: ContentControl
base.OnPointerPressed(e);
if (!IsReadOnly)
{
Command?.Execute(null);
Command?.Execute(CommandParameter);
}
}
}