wip
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Pilz.UI.AvaloniaUI.Dialogs.HeaderMenuItem"
|
||||
x:Class="Pilz.UI.AvaloniaUI.Controls.HeaderMenuItem"
|
||||
x:Name="RootItem">
|
||||
|
||||
<MenuItem.Header>
|
||||
<StackPanel Orientation="Horizontal" Spacing="3">
|
||||
<ContentControl Content="{Binding #RootItem.Icon}"/>
|
||||
<TextBlock x:Name="TextBlockHeader"/>
|
||||
<ContentControl x:Name="ContentControlHeaderIcon" IsVisible="False"/>
|
||||
<TextBlock x:Name="TextBlockHeaderText"/>
|
||||
</StackPanel>
|
||||
</MenuItem.Header>
|
||||
</MenuItem>
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Pilz.UI.AvaloniaUI.Dialogs;
|
||||
|
||||
public partial class HeaderMenuItem : MenuItem
|
||||
{
|
||||
public static readonly StyledProperty<string?> HeaderTextProperty = AvaloniaProperty.Register<HeaderMenuItem, string?>(nameof(HeaderText));
|
||||
|
||||
public string? HeaderText
|
||||
{
|
||||
get => GetValue(HeaderTextProperty);
|
||||
set
|
||||
{
|
||||
SetValue(HeaderTextProperty, value);
|
||||
TextBlockHeader.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public HeaderMenuItem()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,10 @@
|
||||
<DependentUpon>ImageDropDownButton.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Controls\HeaderMenuItem.axaml.cs">
|
||||
<DependentUpon>HeaderMenuItem.axaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user