42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
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();
|
|
}
|
|
} |