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

32 lines
739 B
C#
Raw Permalink 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
2022-01-11 19:42:12 +01:00
namespace MapControl.UiTools
2021-12-05 17:16:14 +01:00
{
[ContentProperty(Name = nameof(Items))]
public partial class MenuButton
2021-12-05 17:16:14 +01:00
{
public MenuButton()
2022-01-11 19:42:12 +01:00
{
Flyout = new MenuFlyout();
Loaded += async (s, e) => await Initialize();
2022-01-11 19:42:12 +01:00
}
public string Icon
2021-12-05 17:16:14 +01:00
{
get => (Content as FontIcon)?.Glyph;
set => Content = new FontIcon { Glyph = value };
2021-12-05 17:16:14 +01:00
}
public MenuFlyout Menu => (MenuFlyout)Flyout;
2021-12-05 17:16:14 +01:00
public IList<MenuFlyoutItemBase> Items => Menu.Items;
2021-12-05 17:16:14 +01:00
}
}