This commit is contained in:
2025-11-30 09:34:46 +01:00
parent 18c77aacbe
commit c2dcc88e22
4 changed files with 49 additions and 27 deletions

View File

@@ -0,0 +1,42 @@
using Avalonia;
using Avalonia.Controls;
namespace Pilz.UI.AvaloniaUI.Controls;
public partial class HeaderMenuItem : MenuItem
{
public static readonly StyledProperty<string?> HeaderTextProperty = AvaloniaProperty.Register<HeaderMenuItem, string?>(nameof(HeaderText));
public static readonly StyledProperty<object?> HeaderIconProperty = AvaloniaProperty.Register<HeaderMenuItem, object?>(nameof(HeaderIcon));
public string? HeaderText
{
get => GetValue(HeaderTextProperty);
set
{
SetValue(HeaderTextProperty, value);
TextBlockHeaderText.Text = value;
}
}
public object? HeaderIcon
{
get => GetValue(HeaderIconProperty);
set
{
SetValue(HeaderIconProperty, value);
ContentControlHeaderIcon.Content = value;
ContentControlHeaderIcon.IsVisible = value != null;
}
}
public new object? Icon
{
get => HeaderIcon;
set => HeaderIcon = value;
}
public HeaderMenuItem()
{
InitializeComponent();
}
}