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

23 lines
498 B
C#
Raw Normal View History

using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
2026-04-13 17:14:49 +02:00
namespace MapControl.UiTools;
public partial class MapMenuItem : MenuItem
{
2026-04-13 17:14:49 +02:00
protected MapMenuItem()
{
2026-04-13 17:14:49 +02:00
Loaded += (_, _) => Initialize();
Click += (_, _) => Execute();
}
2026-04-13 17:14:49 +02:00
public string Text
{
get => Header as string;
set => Header = value;
}
2026-04-13 17:14:49 +02:00
protected IEnumerable<MapMenuItem> ParentMenuItems => ((ItemsControl)Parent).Items.OfType<MapMenuItem>();
}