wip
This commit is contained in:
42
Pilz.UI.AvaloniaUI/Controls/HeaderMenuItem.axaml.cs
Normal file
42
Pilz.UI.AvaloniaUI/Controls/HeaderMenuItem.axaml.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user