From 69fd0753f752bc5ad5aed10cee7a8751411cb9da Mon Sep 17 00:00:00 2001 From: Clemens Date: Mon, 24 Jan 2022 23:07:36 +0100 Subject: [PATCH] Updated MenuButton --- MapUiTools/WPF/AssemblyInfo.cs | 3 +++ MapUiTools/WPF/MenuButton.WPF.cs | 7 +++++-- MapUiTools/WPF/Themes/Generic.xaml | 11 +++++++++++ MapUiTools/WinUI/MenuButton.WinUI.cs | 8 +------- SampleApps/UniversalApp/MainPage.xaml | 2 +- SampleApps/WinUiApp/MainWindow.xaml | 2 +- SampleApps/WpfApplication/MainWindow.xaml | 8 ++++---- 7 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 MapUiTools/WPF/AssemblyInfo.cs create mode 100644 MapUiTools/WPF/Themes/Generic.xaml diff --git a/MapUiTools/WPF/AssemblyInfo.cs b/MapUiTools/WPF/AssemblyInfo.cs new file mode 100644 index 00000000..9ef4842b --- /dev/null +++ b/MapUiTools/WPF/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Windows; + +[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] diff --git a/MapUiTools/WPF/MenuButton.WPF.cs b/MapUiTools/WPF/MenuButton.WPF.cs index 4476a3be..dbefa9c5 100644 --- a/MapUiTools/WPF/MenuButton.WPF.cs +++ b/MapUiTools/WPF/MenuButton.WPF.cs @@ -6,15 +6,18 @@ 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 { + static MenuButton() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(MenuButton), new FrameworkPropertyMetadata(typeof(MenuButton))); + } + protected MenuButton(string icon) { - FontFamily = new FontFamily("Segoe MDL2 Assets"); Content = icon; Click += (s, e) => ContextMenu.IsOpen = true; diff --git a/MapUiTools/WPF/Themes/Generic.xaml b/MapUiTools/WPF/Themes/Generic.xaml new file mode 100644 index 00000000..9e0ea2fb --- /dev/null +++ b/MapUiTools/WPF/Themes/Generic.xaml @@ -0,0 +1,11 @@ + + + + diff --git a/MapUiTools/WinUI/MenuButton.WinUI.cs b/MapUiTools/WinUI/MenuButton.WinUI.cs index 3a14cd77..f63240e4 100644 --- a/MapUiTools/WinUI/MenuButton.WinUI.cs +++ b/MapUiTools/WinUI/MenuButton.WinUI.cs @@ -7,11 +7,9 @@ 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 @@ -20,11 +18,7 @@ namespace MapControl.UiTools { protected MenuButton(string icon) { - Content = new FontIcon - { - FontFamily = new FontFamily("Segoe Fluent Icons"), - Glyph = icon - }; + Content = new FontIcon { Glyph = icon }; } protected MenuFlyout CreateMenu() diff --git a/SampleApps/UniversalApp/MainPage.xaml b/SampleApps/UniversalApp/MainPage.xaml index 4fce822e..ae1c37de 100644 --- a/SampleApps/UniversalApp/MainPage.xaml +++ b/SampleApps/UniversalApp/MainPage.xaml @@ -214,7 +214,7 @@ - + diff --git a/SampleApps/WinUiApp/MainWindow.xaml b/SampleApps/WinUiApp/MainWindow.xaml index fb71d6cf..22affce1 100644 --- a/SampleApps/WinUiApp/MainWindow.xaml +++ b/SampleApps/WinUiApp/MainWindow.xaml @@ -215,7 +215,7 @@ - + diff --git a/SampleApps/WpfApplication/MainWindow.xaml b/SampleApps/WpfApplication/MainWindow.xaml index 08e1452a..45c5f20f 100644 --- a/SampleApps/WpfApplication/MainWindow.xaml +++ b/SampleApps/WpfApplication/MainWindow.xaml @@ -143,7 +143,7 @@ @@ -167,7 +167,7 @@ @@ -180,8 +180,8 @@ SmallChange="0.1" AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="0"/> -