Update MenuButton.Avalonia.cs

This commit is contained in:
ClemensFischer 2024-08-07 09:53:50 +02:00
parent 218071faea
commit be48c45e91

View file

@ -17,25 +17,18 @@ namespace MapControl
{ {
internal static readonly FontFamily SymbolFont = new("Segoe MDL2 Assets"); internal static readonly FontFamily SymbolFont = new("Segoe MDL2 Assets");
private readonly StackPanel header; private readonly TextBlock icon = new()
private readonly TextBlock icon; {
FontFamily = SymbolFont,
FontWeight = FontWeight.Black,
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center,
};
public ToggleMenuFlyoutItem(string text, object item, EventHandler<RoutedEventArgs> click) public ToggleMenuFlyoutItem(string text, object item, EventHandler<RoutedEventArgs> click)
{ {
icon = new TextBlock Icon = icon;
{ Header = text;
FontFamily = SymbolFont,
Width = 20,
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center
};
header = new StackPanel { Orientation = Avalonia.Layout.Orientation.Horizontal };
header.Children.Add(icon);
header.Children.Add(new TextBlock { Text = text });
Header = header;
Tag = item; Tag = item;
Click += click; Click += click;
} }