feat: introduce Small class and IsReadOnly property.
This commit is contained in:
@@ -56,6 +56,15 @@ public class Breadcrumb: ItemsControl
|
||||
get => GetValue(IconTemplateProperty);
|
||||
set => SetValue(IconTemplateProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<bool> IsReadOnlyProperty = AvaloniaProperty.Register<Breadcrumb, bool>(
|
||||
nameof(IsReadOnly));
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get => GetValue(IsReadOnlyProperty);
|
||||
set => SetValue(IsReadOnlyProperty, value);
|
||||
}
|
||||
|
||||
static Breadcrumb()
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using Avalonia.Controls;
|
||||
using Avalonia.Controls.Metadata;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.LogicalTree;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
@@ -51,6 +52,10 @@ public class BreadcrumbItem: ContentControl
|
||||
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
||||
{
|
||||
base.OnPointerPressed(e);
|
||||
Command?.Execute(null);
|
||||
var parent = this.FindLogicalAncestorOfType<Breadcrumb>();
|
||||
if (parent?.IsReadOnly != true)
|
||||
{
|
||||
Command?.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user