From f478bf5c3bf1a0e35711c9e210578dc9af485354 Mon Sep 17 00:00:00 2001 From: Clemens Date: Mon, 6 Dec 2021 17:54:46 +0100 Subject: [PATCH] Added Heading Reset Button to sample applications --- SampleApps/Shared/ValueConverters.cs | 38 ++++++++++++++++++++ SampleApps/UniversalApp/MainPage.xaml | 26 +++++++++----- SampleApps/UniversalApp/MainPage.xaml.cs | 7 +++- SampleApps/UniversalApp/UniversalApp.csproj | 3 ++ SampleApps/WinUiApp/MainWindow.xaml | 26 +++++++++----- SampleApps/WinUiApp/MainWindow.xaml.cs | 7 +++- SampleApps/WpfApplication/MainWindow.xaml | 12 +++++++ SampleApps/WpfApplication/MainWindow.xaml.cs | 7 +++- 8 files changed, 107 insertions(+), 19 deletions(-) create mode 100644 SampleApps/Shared/ValueConverters.cs diff --git a/SampleApps/Shared/ValueConverters.cs b/SampleApps/Shared/ValueConverters.cs new file mode 100644 index 00000000..dced2c50 --- /dev/null +++ b/SampleApps/Shared/ValueConverters.cs @@ -0,0 +1,38 @@ +using System; +using System.Globalization; +#if WINUI +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Data; +#elif UWP +using Windows.UI.Xaml; +using Windows.UI.Xaml.Data; +#else +using System.Windows; +using System.Windows.Data; +#endif + +namespace SampleApplication +{ + public class HeadingToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, string language) + { + return (double)value != 0d ? Visibility.Visible : Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + throw new NotImplementedException(); + } + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return Convert(value, targetType, parameter, ""); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + return ConvertBack(value, targetType, parameter, ""); + } + } +} \ No newline at end of file diff --git a/SampleApps/UniversalApp/MainPage.xaml b/SampleApps/UniversalApp/MainPage.xaml index 46483743..ab28fcde 100644 --- a/SampleApps/UniversalApp/MainPage.xaml +++ b/SampleApps/UniversalApp/MainPage.xaml @@ -1,9 +1,8 @@ - + @@ -84,8 +83,8 @@ - @@ -131,6 +130,17 @@ Minimum="{Binding MinZoomLevel, ElementName=map}" Maximum="{Binding MaxZoomLevel, ElementName=map}" Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/> + + MenuButton.cs + + ValueConverters.cs + App.xaml diff --git a/SampleApps/WinUiApp/MainWindow.xaml b/SampleApps/WinUiApp/MainWindow.xaml index c62f46bd..6d2ab09e 100644 --- a/SampleApps/WinUiApp/MainWindow.xaml +++ b/SampleApps/WinUiApp/MainWindow.xaml @@ -1,9 +1,8 @@ - + @@ -85,8 +84,8 @@ - @@ -132,6 +131,17 @@ Minimum="{Binding MinZoomLevel, ElementName=map}" Maximum="{Binding MaxZoomLevel, ElementName=map}" Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/> + + + @@ -159,6 +160,17 @@ Value="{Binding TargetZoomLevel, ElementName=map}" SmallChange="0.1" AutoToolTipPlacement="BottomRight" AutoToolTipPrecision="0"/> + +