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

28 lines
643 B
C#
Raw Normal View History

using System.Collections.Generic;
using System.Linq;
#if UWP
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
#else
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
#endif
2026-04-13 17:14:49 +02:00
namespace MapControl.UiTools;
public abstract partial class MapMenuItem : ToggleMenuFlyoutItem
{
2026-04-13 17:14:49 +02:00
protected MapMenuItem()
{
2026-04-13 17:14:49 +02:00
Loaded += (_, _) =>
2025-03-24 18:59:58 +01:00
{
2026-04-13 17:14:49 +02:00
ParentMenuItems = ((Panel)VisualTreeHelper.GetParent(this)).Children.OfType<MapMenuItem>().ToList();
Initialize();
};
2025-03-21 18:03:57 +01:00
2026-04-13 17:14:49 +02:00
Click += (_, _) => Execute();
}
2026-04-13 17:14:49 +02:00
protected IList<MapMenuItem> ParentMenuItems { get; private set; }
}