XAML-Map-Control/MapUiTools/WinUI/MenuButton.WinUI.cs

31 lines
673 B
C#
Raw Normal View History

2025-02-27 18:46:32 +01:00
using System.Collections.Generic;
2024-05-24 15:15:29 +02:00
#if UWP
2021-12-05 17:16:14 +01:00
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Markup;
2024-05-24 15:15:29 +02:00
#elif WINUI
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Markup;
2021-12-05 17:16:14 +01:00
#endif
2026-04-13 17:14:49 +02:00
namespace MapControl.UiTools;
[ContentProperty(Name = nameof(Items))]
public partial class MenuButton
2021-12-05 17:16:14 +01:00
{
2026-04-13 17:14:49 +02:00
public MenuButton()
2021-12-05 17:16:14 +01:00
{
2026-04-13 17:14:49 +02:00
Flyout = new MenuFlyout();
Loaded += async (_, _) => await Initialize();
}
2022-01-11 19:42:12 +01:00
2026-04-13 17:14:49 +02:00
public string Icon
{
get => (Content as FontIcon)?.Glyph;
set => Content = new FontIcon { Glyph = value };
}
2021-12-05 17:16:14 +01:00
2026-04-13 17:14:49 +02:00
public MenuFlyout Menu => (MenuFlyout)Flyout;
2021-12-05 17:16:14 +01:00
2026-04-13 17:14:49 +02:00
public IList<MenuFlyoutItemBase> Items => Menu.Items;
2021-12-05 17:16:14 +01:00
}