mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Updated MenuButton
This commit is contained in:
parent
b921600e1b
commit
69fd0753f7
3
MapUiTools/WPF/AssemblyInfo.cs
Normal file
3
MapUiTools/WPF/AssemblyInfo.cs
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
||||||
|
|
@ -6,15 +6,18 @@ using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
|
||||||
|
|
||||||
namespace MapControl.UiTools
|
namespace MapControl.UiTools
|
||||||
{
|
{
|
||||||
public class MenuButton : Button
|
public class MenuButton : Button
|
||||||
{
|
{
|
||||||
|
static MenuButton()
|
||||||
|
{
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(MenuButton), new FrameworkPropertyMetadata(typeof(MenuButton)));
|
||||||
|
}
|
||||||
|
|
||||||
protected MenuButton(string icon)
|
protected MenuButton(string icon)
|
||||||
{
|
{
|
||||||
FontFamily = new FontFamily("Segoe MDL2 Assets");
|
|
||||||
Content = icon;
|
Content = icon;
|
||||||
|
|
||||||
Click += (s, e) => ContextMenu.IsOpen = true;
|
Click += (s, e) => ContextMenu.IsOpen = true;
|
||||||
|
|
|
||||||
11
MapUiTools/WPF/Themes/Generic.xaml
Normal file
11
MapUiTools/WPF/Themes/Generic.xaml
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:tools="clr-namespace:MapControl.UiTools">
|
||||||
|
|
||||||
|
<Style TargetType="tools:MenuButton" BasedOn="{StaticResource {x:Type Button}}">
|
||||||
|
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
|
||||||
|
<Setter Property="FontSize" Value="20"/>
|
||||||
|
<Setter Property="Padding" Value="8"/>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
@ -7,11 +7,9 @@ using System.Linq;
|
||||||
#if WINUI
|
#if WINUI
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Media;
|
|
||||||
#elif UWP
|
#elif UWP
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Media;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace MapControl.UiTools
|
namespace MapControl.UiTools
|
||||||
|
|
@ -20,11 +18,7 @@ namespace MapControl.UiTools
|
||||||
{
|
{
|
||||||
protected MenuButton(string icon)
|
protected MenuButton(string icon)
|
||||||
{
|
{
|
||||||
Content = new FontIcon
|
Content = new FontIcon { Glyph = icon };
|
||||||
{
|
|
||||||
FontFamily = new FontFamily("Segoe Fluent Icons"),
|
|
||||||
Glyph = icon
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected MenuFlyout CreateMenu()
|
protected MenuFlyout CreateMenu()
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@
|
||||||
</Binding.Converter>
|
</Binding.Converter>
|
||||||
</Binding>
|
</Binding>
|
||||||
</Button.Visibility>
|
</Button.Visibility>
|
||||||
<FontIcon FontFamily="Segoe Fluent Icons" Glyph=""/>
|
<FontIcon Glyph=""/>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@
|
||||||
</Binding.Converter>
|
</Binding.Converter>
|
||||||
</Binding>
|
</Binding>
|
||||||
</Button.Visibility>
|
</Button.Visibility>
|
||||||
<FontIcon FontFamily="Segoe Fluent Icons" Glyph=""/>
|
<FontIcon Glyph=""/>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@
|
||||||
|
|
||||||
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6">
|
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6">
|
||||||
<tools:MapLayersMenuButton x:Name="mapLayersMenuButton"
|
<tools:MapLayersMenuButton x:Name="mapLayersMenuButton"
|
||||||
Margin="2" Padding="6" FontSize="16" ToolTip="Map Layers and Overlays"
|
Margin="2" ToolTip="Map Layers and Overlays"
|
||||||
Map="{Binding ElementName=map}">
|
Map="{Binding ElementName=map}">
|
||||||
<tools:MapLayerItem Text="OpenStreetMap" Layer="{StaticResource OpenStreetMap}"/>
|
<tools:MapLayerItem Text="OpenStreetMap" Layer="{StaticResource OpenStreetMap}"/>
|
||||||
<tools:MapLayerItem Text="OpenStreetMap German" Layer="{StaticResource OpenStreetMapGerman}"/>
|
<tools:MapLayerItem Text="OpenStreetMap German" Layer="{StaticResource OpenStreetMapGerman}"/>
|
||||||
|
|
@ -167,7 +167,7 @@
|
||||||
</tools:MapLayersMenuButton>
|
</tools:MapLayersMenuButton>
|
||||||
|
|
||||||
<tools:MapProjectionsMenuButton x:Name="mapProjectionsMenuButton"
|
<tools:MapProjectionsMenuButton x:Name="mapProjectionsMenuButton"
|
||||||
Margin="2" Padding="6" FontSize="16" ToolTip="Map Projections"
|
Margin="2" ToolTip="Map Projections"
|
||||||
Map="{Binding ElementName=map}">
|
Map="{Binding ElementName=map}">
|
||||||
<tools:MapProjectionItem Text="Web Mercator" Projection="EPSG:3857"/>
|
<tools:MapProjectionItem Text="Web Mercator" Projection="EPSG:3857"/>
|
||||||
<tools:MapProjectionItem Text="Equirectangular" Projection="EPSG:4326"/>
|
<tools:MapProjectionItem Text="Equirectangular" Projection="EPSG:4326"/>
|
||||||
|
|
@ -180,8 +180,8 @@
|
||||||
SmallChange="0.1"
|
SmallChange="0.1"
|
||||||
AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="0"/>
|
AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="0"/>
|
||||||
|
|
||||||
<Button Margin="2" Padding="8" ToolTipService.ToolTip="Reset Heading" Click="ResetHeadingButtonClick"
|
<Button Margin="2" Padding="8" ToolTip="Reset Heading" Click="ResetHeadingButtonClick"
|
||||||
FontSize="16" FontFamily="Segoe MDL2 Assets" Content="">
|
FontSize="20" FontFamily="Segoe MDL2 Assets" Content="">
|
||||||
<Button.Visibility>
|
<Button.Visibility>
|
||||||
<Binding Path="Heading" ElementName="map">
|
<Binding Path="Heading" ElementName="map">
|
||||||
<Binding.Converter>
|
<Binding.Converter>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue