2022-01-11 19:42:12 +01:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2024-02-03 21:01:53 +01:00
|
|
|
|
// Copyright © 2024 Clemens Fischer
|
2022-01-11 19:42:12 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2021-12-05 17:16:14 +01:00
|
|
|
|
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
|
|
|
|
|
|
|
2022-01-11 19:42:12 +01:00
|
|
|
|
namespace MapControl.UiTools
|
2021-12-05 17:16:14 +01:00
|
|
|
|
{
|
|
|
|
|
|
public class MenuButton : Button
|
|
|
|
|
|
{
|
2022-01-11 19:42:12 +01:00
|
|
|
|
protected MenuButton(string icon)
|
|
|
|
|
|
{
|
2022-01-24 23:07:36 +01:00
|
|
|
|
Content = new FontIcon { Glyph = icon };
|
2022-01-11 19:42:12 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-12-05 17:16:14 +01:00
|
|
|
|
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();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|