mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
|
// © 2022 Clemens Fischer
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
#if WINUI
|
|
using Microsoft.UI.Xaml;
|
|
using Microsoft.UI.Xaml.Controls;
|
|
#elif UWP
|
|
using Windows.UI.Xaml;
|
|
using Windows.UI.Xaml.Controls;
|
|
#endif
|
|
|
|
namespace MapControl.UiTools
|
|
{
|
|
public class MenuButton : Button
|
|
{
|
|
protected MenuButton(string icon)
|
|
{
|
|
Content = new FontIcon { Glyph = icon };
|
|
}
|
|
|
|
protected MenuFlyout CreateMenu()
|
|
{
|
|
var menu = new MenuFlyout();
|
|
Flyout = menu;
|
|
return menu;
|
|
}
|
|
|
|
protected IEnumerable<ToggleMenuFlyoutItem> GetMenuItems()
|
|
{
|
|
return ((MenuFlyout)Flyout).Items.OfType<ToggleMenuFlyoutItem>();
|
|
}
|
|
|
|
protected static ToggleMenuFlyoutItem CreateMenuItem(string text, object item, RoutedEventHandler click)
|
|
{
|
|
var menuItem = new ToggleMenuFlyoutItem { Text = text, Tag = item };
|
|
menuItem.Click += click;
|
|
return menuItem;
|
|
}
|
|
|
|
protected static MenuFlyoutSeparator CreateSeparator()
|
|
{
|
|
return new MenuFlyoutSeparator();
|
|
}
|
|
}
|
|
}
|