diff --git a/MapControl/Shared/MapTileLayerBase.cs b/MapControl/Shared/MapTileLayerBase.cs index d295fd14..44bcc61c 100644 --- a/MapControl/Shared/MapTileLayerBase.cs +++ b/MapControl/Shared/MapTileLayerBase.cs @@ -61,8 +61,7 @@ namespace MapControl nameof(MapForeground), typeof(Brush), typeof(MapTileLayerBase), new PropertyMetadata(null)); public static readonly DependencyProperty LoadingProgressProperty = DependencyProperty.Register( - nameof(LoadingProgress), typeof(double), typeof(MapTileLayerBase), new PropertyMetadata(1d, - (o, e) => { System.Diagnostics.Debug.WriteLine("LoadingProgress = {0:P0}", e.NewValue); })); + nameof(LoadingProgress), typeof(double), typeof(MapTileLayerBase), new PropertyMetadata(1d)); private readonly DispatcherTimer updateTimer; private MapBase parentMap; diff --git a/MapControl/WinUI/PushpinBorder.WinUI.cs b/MapControl/WinUI/PushpinBorder.WinUI.cs index f8096809..46033de6 100644 --- a/MapControl/WinUI/PushpinBorder.WinUI.cs +++ b/MapControl/WinUI/PushpinBorder.WinUI.cs @@ -45,25 +45,25 @@ namespace MapControl path.SetBinding(Shape.FillProperty, new Binding { - Path = new PropertyPath("Background"), + Path = new PropertyPath(nameof(Background)), Source = this }); path.SetBinding(Shape.StrokeProperty, new Binding { - Path = new PropertyPath("BorderBrush"), + Path = new PropertyPath(nameof(BorderBrush)), Source = this }); path.SetBinding(Shape.StrokeThicknessProperty, new Binding { - Path = new PropertyPath("BorderThickness"), + Path = new PropertyPath(nameof(BorderWidth)), Source = this }); border.SetBinding(PaddingProperty, new Binding { - Path = new PropertyPath("Padding"), + Path = new PropertyPath(nameof(Padding)), Source = this }); diff --git a/SampleApps/Shared/ValueConverters.cs b/SampleApps/Shared/ValueConverters.cs index c415cfa0..c2009bb7 100644 --- a/SampleApps/Shared/ValueConverters.cs +++ b/SampleApps/Shared/ValueConverters.cs @@ -1,30 +1,25 @@ using System; +using System.ComponentModel; 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 DoubleToVisibilityConverter : IValueConverter + public class DoubleTriggerConverter : IValueConverter { + public double Trigger { get; set; } + public object TriggerValue { get; set; } + public object DefaultValue { get; set; } + public object Convert(object value, Type targetType, object parameter, string language) { - if (!(parameter is double p)) - { - p = double.Parse(parameter.ToString()); - } + var converter = TypeDescriptor.GetConverter(targetType); - //System.Diagnostics.Debug.WriteLine((double)value); - - return (double)value != p ? Visibility.Visible : Visibility.Collapsed; + return (double)value == Trigger ? converter.ConvertFrom(TriggerValue) : converter.ConvertFrom(DefaultValue); } public object ConvertBack(object value, Type targetType, object parameter, string language) diff --git a/SampleApps/UniversalApp/MainPage.xaml b/SampleApps/UniversalApp/MainPage.xaml index 63fe6ba1..4ed57426 100644 --- a/SampleApps/UniversalApp/MainPage.xaml +++ b/SampleApps/UniversalApp/MainPage.xaml @@ -80,8 +80,6 @@ - - @@ -113,10 +111,28 @@ - - + + + + + + + + + + + + + + + + + + - + @@ -216,8 +232,14 @@ Maximum="{Binding MaxZoomLevel, ElementName=map}" Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/> - diff --git a/SampleApps/WinUiApp/MainWindow.xaml b/SampleApps/WinUiApp/MainWindow.xaml index 4a3fb09a..ab229233 100644 --- a/SampleApps/WinUiApp/MainWindow.xaml +++ b/SampleApps/WinUiApp/MainWindow.xaml @@ -80,8 +80,6 @@ - - @@ -113,11 +111,24 @@ - + Value="{Binding MapLayer.LoadingProgress, ElementName=map}"> + + + + + + + + + + + + + + + @@ -220,8 +231,14 @@ Maximum="{Binding MaxZoomLevel, ElementName=map}" Value="{Binding TargetZoomLevel, ElementName=map, Mode=TwoWay}"/> - diff --git a/SampleApps/WpfApplication/WpfApplication.csproj b/SampleApps/WpfApplication/WpfApplication.csproj index d6de514c..a77d9798 100644 --- a/SampleApps/WpfApplication/WpfApplication.csproj +++ b/SampleApps/WpfApplication/WpfApplication.csproj @@ -17,7 +17,7 @@ - +