Version 7.1.0: Added MapUiTools

This commit is contained in:
Clemens 2022-01-11 19:42:12 +01:00
parent 731158c22d
commit 2ac4985c47
37 changed files with 437 additions and 463 deletions

View file

@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<RootNamespace>MapControl.UiTools</RootNamespace>
<AssemblyTitle>XAML Map Control UI Tools Library for WinUI</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>WINUI</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Include="..\..\MapControl.snk" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Shared\*.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.196" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MapControl\WinUI\MapControl.WinUI.csproj" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,54 @@
// 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;
#if WINUI
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
#elif UWP
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
#endif
namespace MapControl.UiTools
{
public class MenuButton : Button
{
protected MenuButton(string icon)
{
Content = new FontIcon
{
FontFamily = new FontFamily("Segoe Fluent Icons"),
Glyph = icon
};
}
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();
}
}
}