mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Update MenuButton.cs
This commit is contained in:
parent
d00b16fd78
commit
3526438f58
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Threading.Tasks;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
#if WPF
|
#if WPF
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
|
@ -33,9 +34,13 @@ namespace MapControl.UiTools
|
||||||
{
|
{
|
||||||
DataContext = Map;
|
DataContext = Map;
|
||||||
|
|
||||||
if (Items.Count > 0 && Items[0] is MapMenuItem item)
|
var initialItem =
|
||||||
|
Items.OfType<MapMenuItem>().FirstOrDefault(item => item.IsChecked) ??
|
||||||
|
Items.OfType<MapMenuItem>().FirstOrDefault();
|
||||||
|
|
||||||
|
if (initialItem != null)
|
||||||
{
|
{
|
||||||
await item.Execute(Map);
|
await initialItem.Execute(Map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue