mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-08 07:55:13 +00:00
Version 7.1.0: Added MapUiTools
This commit is contained in:
parent
731158c22d
commit
2ac4985c47
37 changed files with 437 additions and 463 deletions
28
MapUiTools/WPF/MapUiTools.WPF.csproj
Normal file
28
MapUiTools/WPF/MapUiTools.WPF.csproj
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net6.0-windows;net5.0-windows;netcoreapp3.1;net48;net462</TargetFrameworks>
|
||||
<UseWPF>true</UseWPF>
|
||||
<RootNamespace>MapControl.UiTools</RootNamespace>
|
||||
<AssemblyTitle>XAML Map Control UI Tools Library for WPF</AssemblyTitle>
|
||||
<Product>XAML Map Control</Product>
|
||||
<Version>7.1.0</Version>
|
||||
<Authors>Clemens Fischer</Authors>
|
||||
<Copyright>Copyright © 2022 Clemens Fischer</Copyright>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
<AssemblyOriginatorKeyFile>..\..\MapControl.snk</AssemblyOriginatorKeyFile>
|
||||
<DelaySign>false</DelaySign>
|
||||
<DefineConstants></DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\..\MapControl.snk" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\Shared\*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\MapControl\WPF\MapControl.WPF.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
47
MapUiTools/WPF/MenuButton.WPF.cs
Normal file
47
MapUiTools/WPF/MenuButton.WPF.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// 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;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace MapControl.UiTools
|
||||
{
|
||||
public class MenuButton : Button
|
||||
{
|
||||
protected MenuButton(string icon)
|
||||
{
|
||||
FontFamily = new FontFamily("Segoe MDL2 Assets");
|
||||
Content = icon;
|
||||
|
||||
Click += (s, e) => ContextMenu.IsOpen = true;
|
||||
}
|
||||
|
||||
protected ContextMenu CreateMenu()
|
||||
{
|
||||
var menu = new ContextMenu();
|
||||
ContextMenu = menu;
|
||||
return menu;
|
||||
}
|
||||
|
||||
protected IEnumerable<MenuItem> GetMenuItems()
|
||||
{
|
||||
return ContextMenu.Items.OfType<MenuItem>();
|
||||
}
|
||||
|
||||
protected static MenuItem CreateMenuItem(string text, object item, RoutedEventHandler click)
|
||||
{
|
||||
var menuItem = new MenuItem { Header = text, Tag = item };
|
||||
menuItem.Click += click;
|
||||
return menuItem;
|
||||
}
|
||||
|
||||
protected static Separator CreateSeparator()
|
||||
{
|
||||
return new Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue