mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
38 lines
1,005 B
C#
38 lines
1,005 B
C#
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Media;
|
|
using Avalonia.Metadata;
|
|
using Avalonia.Styling;
|
|
using System;
|
|
|
|
namespace MapControl.UiTools
|
|
{
|
|
public partial class MenuButton
|
|
{
|
|
public MenuButton()
|
|
{
|
|
var style = new Style();
|
|
style.Setters.Add(new Setter(TextBlock.FontFamilyProperty, new FontFamily("Segoe MDL2 Assets")));
|
|
style.Setters.Add(new Setter(TextBlock.FontSizeProperty, 20d));
|
|
style.Setters.Add(new Setter(PaddingProperty, new Thickness(8)));
|
|
Styles.Add(style);
|
|
|
|
Flyout = new MenuFlyout();
|
|
Loaded += async (s, e) => await Initialize();
|
|
}
|
|
|
|
public string Icon
|
|
{
|
|
get => Content as string;
|
|
set => Content = value;
|
|
}
|
|
|
|
public MenuFlyout Menu => (MenuFlyout)Flyout;
|
|
|
|
[Content]
|
|
public ItemCollection Items => Menu.Items;
|
|
|
|
protected override Type StyleKeyOverride => typeof(Button);
|
|
}
|
|
}
|