diff --git a/FileDbCache/UWP/FileDbCache.UWP.csproj b/FileDbCache/UWP/FileDbCache.UWP.csproj
index 00d918c0..1fe27119 100644
--- a/FileDbCache/UWP/FileDbCache.UWP.csproj
+++ b/FileDbCache/UWP/FileDbCache.UWP.csproj
@@ -46,7 +46,7 @@
- 6.0.8
+ 6.1.2
diff --git a/MBTiles/UWP/MBTiles.UWP.csproj b/MBTiles/UWP/MBTiles.UWP.csproj
index 742b4684..f0fe2509 100644
--- a/MBTiles/UWP/MBTiles.UWP.csproj
+++ b/MBTiles/UWP/MBTiles.UWP.csproj
@@ -49,10 +49,10 @@
- 2.0.0
+ 2.0.1
- 6.0.8
+ 6.1.2
diff --git a/MapControl/Shared/MapOverlay.cs b/MapControl/Shared/MapOverlay.cs
index 07606129..c5a6764b 100644
--- a/MapControl/Shared/MapOverlay.cs
+++ b/MapControl/Shared/MapOverlay.cs
@@ -10,7 +10,9 @@ using Windows.UI.Xaml.Media;
#else
using System.Windows;
using System.Windows.Data;
+using System.Windows.Documents;
using System.Windows.Media;
+using System.Windows.Shapes;
#endif
namespace MapControl
@@ -20,10 +22,15 @@ namespace MapControl
///
public partial class MapOverlay : MapPanel
{
- public double FontSize
+ public MapOverlay()
{
- get { return (double)GetValue(FontSizeProperty); }
- set { SetValue(FontSizeProperty, value); }
+ Loaded += (s, e) =>
+ {
+ if (Stroke == null)
+ {
+ SetBinding(StrokeProperty, GetBinding(ForegroundProperty, nameof(Foreground)));
+ }
+ };
}
public FontFamily FontFamily
@@ -32,6 +39,12 @@ namespace MapControl
set { SetValue(FontFamilyProperty, value); }
}
+ public double FontSize
+ {
+ get { return (double)GetValue(FontSizeProperty); }
+ set { SetValue(FontSizeProperty, value); }
+ }
+
public FontStyle FontStyle
{
get { return (FontStyle)GetValue(FontStyleProperty); }
@@ -110,103 +123,7 @@ namespace MapControl
set { SetValue(StrokeMiterLimitProperty, value); }
}
- public Binding FontSizeBinding
- {
- get { return GetBinding(FontSizeProperty, nameof(FontSize)); }
- }
-
- public Binding FontFamilyBinding
- {
- get { return GetBinding(FontFamilyProperty, nameof(FontFamily)); }
- }
-
- public Binding FontStyleBinding
- {
- get { return GetBinding(FontStyleProperty, nameof(FontStyle)); }
- }
-
- public Binding FontStretchBinding
- {
- get { return GetBinding(FontStretchProperty, nameof(FontStretch)); }
- }
-
- public Binding FontWeightBinding
- {
- get { return GetBinding(FontWeightProperty, nameof(FontWeight)); }
- }
-
- public Binding ForegroundBinding
- {
- get { return GetBinding(ForegroundProperty, nameof(Foreground)); }
- }
-
- public Binding StrokeBinding
- {
- get { return GetBinding(StrokeProperty, nameof(Stroke)); }
- }
-
- public Binding StrokeThicknessBinding
- {
- get { return GetBinding(StrokeThicknessProperty, nameof(StrokeThickness)); }
- }
-
- public Binding StrokeDashArrayBinding
- {
- get { return GetBinding(StrokeDashArrayProperty, nameof(StrokeDashArray)); }
- }
-
- public Binding StrokeDashOffsetBinding
- {
- get { return GetBinding(StrokeDashOffsetProperty, nameof(StrokeDashOffset)); }
- }
-
- public Binding StrokeDashCapBinding
- {
- get { return GetBinding(StrokeDashCapProperty, nameof(StrokeDashCap)); }
- }
-
- public Binding StrokeStartLineCapBinding
- {
- get { return GetBinding(StrokeStartLineCapProperty, nameof(StrokeStartLineCap)); }
- }
-
- public Binding StrokeEndLineCapBinding
- {
- get { return GetBinding(StrokeEndLineCapProperty, nameof(StrokeEndLineCap)); }
- }
-
- public Binding StrokeLineJoinBinding
- {
- get { return GetBinding(StrokeLineJoinProperty, nameof(StrokeLineJoin)); }
- }
-
- public Binding StrokeMiterLimitBinding
- {
- get { return GetBinding(StrokeMiterLimitProperty, nameof(StrokeMiterLimit)); }
- }
-
- protected override void SetParentMap(MapBase map)
- {
- if (map != null)
- {
-#if WINDOWS_UWP
- if (Foreground == null)
- {
- SetBinding(ForegroundProperty,
- map.GetBindingExpression(MapBase.ForegroundProperty)?.ParentBinding ??
- new Binding { Source = map, Path = new PropertyPath("Foreground") });
- }
-#endif
- if (Stroke == null)
- {
- SetBinding(StrokeProperty, ForegroundBinding);
- }
- }
-
- base.SetParentMap(map);
- }
-
- private Binding GetBinding(DependencyProperty property, string propertyName)
+ protected Binding GetBinding(DependencyProperty property, string propertyName)
{
return GetBindingExpression(property)?.ParentBinding ??
new Binding { Source = this, Path = new PropertyPath(propertyName) };
diff --git a/MapControl/Shared/MapPanel.cs b/MapControl/Shared/MapPanel.cs
index a0042a6e..71248702 100644
--- a/MapControl/Shared/MapPanel.cs
+++ b/MapControl/Shared/MapPanel.cs
@@ -92,6 +92,16 @@ namespace MapControl
}
}
+ private void OnViewportChanged(object sender, ViewportChangedEventArgs e)
+ {
+ OnViewportChanged(e);
+ }
+
+ protected virtual void OnViewportChanged(ViewportChangedEventArgs e)
+ {
+ InvalidateArrange();
+ }
+
protected override Size MeasureOverride(Size availableSize)
{
availableSize = new Size(double.PositiveInfinity, double.PositiveInfinity);
@@ -131,16 +141,6 @@ namespace MapControl
return finalSize;
}
- protected virtual void OnViewportChanged(ViewportChangedEventArgs e)
- {
- InvalidateArrange();
- }
-
- private void OnViewportChanged(object sender, ViewportChangedEventArgs e)
- {
- OnViewportChanged(e);
- }
-
private static void ParentMapPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
var mapElement = obj as IMapElement;
diff --git a/MapControl/Shared/MapScale.cs b/MapControl/Shared/MapScale.cs
index fde472bd..1b17daa9 100644
--- a/MapControl/Shared/MapScale.cs
+++ b/MapControl/Shared/MapScale.cs
@@ -28,21 +28,22 @@ namespace MapControl
public static readonly DependencyProperty PaddingProperty = DependencyProperty.Register(
nameof(Padding), typeof(Thickness), typeof(MapScale), new PropertyMetadata(new Thickness(4)));
- private TextBlock label = new TextBlock();
- private Polyline line = new Polyline();
+ private readonly Polyline line = new Polyline();
+
+ private readonly TextBlock label = new TextBlock
+ {
+ HorizontalAlignment = HorizontalAlignment.Left,
+ VerticalAlignment = VerticalAlignment.Top,
+ TextAlignment = TextAlignment.Center
+ };
public MapScale()
{
IsHitTestVisible = false;
MinWidth = 100d;
- label.HorizontalAlignment = HorizontalAlignment.Left;
- label.VerticalAlignment = VerticalAlignment.Top;
- label.TextAlignment = TextAlignment.Center;
- label.SetBinding(TextBlock.ForegroundProperty, ForegroundBinding);
-
- line.SetBinding(Shape.StrokeProperty, StrokeBinding);
- line.SetBinding(Shape.StrokeThicknessProperty, StrokeThicknessBinding);
+ line.SetBinding(Shape.StrokeProperty, GetBinding(StrokeProperty, nameof(Stroke)));
+ line.SetBinding(Shape.StrokeThicknessProperty, GetBinding(StrokeThicknessProperty, nameof(StrokeThickness)));
Children.Add(line);
Children.Add(label);
@@ -91,18 +92,8 @@ namespace MapControl
new Point(x2, y2),
new Point(x2, y1)
};
-
line.Measure(size);
- if (FontFamily != null)
- {
- label.FontFamily = FontFamily;
- }
-
- label.FontSize = FontSize;
- label.FontStyle = FontStyle;
- label.FontStretch = FontStretch;
- label.FontWeight = FontWeight;
label.Text = length >= 1000d ? string.Format("{0:0} km", length / 1000d) : string.Format("{0:0} m", length);
label.Width = size.Width;
label.Height = size.Height;
diff --git a/MapControl/UWP/MapControl.UWP.csproj b/MapControl/UWP/MapControl.UWP.csproj
index 338aff06..5fe14828 100644
--- a/MapControl/UWP/MapControl.UWP.csproj
+++ b/MapControl/UWP/MapControl.UWP.csproj
@@ -168,7 +168,7 @@
- 6.0.8
+ 6.1.2
diff --git a/MapControl/UWP/MapGraticule.UWP.cs b/MapControl/UWP/MapGraticule.UWP.cs
index c955f256..1651106a 100644
--- a/MapControl/UWP/MapGraticule.UWP.cs
+++ b/MapControl/UWP/MapGraticule.UWP.cs
@@ -31,11 +31,11 @@ namespace MapControl
if (path == null)
{
path = new Path { Data = new PathGeometry() };
- path.SetBinding(Shape.StrokeProperty, StrokeBinding);
- path.SetBinding(Shape.StrokeThicknessProperty, StrokeThicknessBinding);
- path.SetBinding(Shape.StrokeDashArrayProperty, StrokeDashArrayBinding);
- path.SetBinding(Shape.StrokeDashOffsetProperty, StrokeDashOffsetBinding);
- path.SetBinding(Shape.StrokeDashCapProperty, StrokeDashCapBinding);
+ path.SetBinding(Shape.StrokeProperty, GetBinding(StrokeProperty, nameof(Stroke)));
+ path.SetBinding(Shape.StrokeThicknessProperty, GetBinding(StrokeThicknessProperty, nameof(StrokeThickness)));
+ path.SetBinding(Shape.StrokeDashArrayProperty, GetBinding(StrokeDashArrayProperty, nameof(StrokeDashArray)));
+ path.SetBinding(Shape.StrokeDashOffsetProperty, GetBinding(StrokeDashOffsetProperty, nameof(StrokeDashOffset)));
+ path.SetBinding(Shape.StrokeDashCapProperty, GetBinding(StrokeDashCapProperty, nameof(StrokeDashCap)));
Children.Add(path);
}
@@ -118,13 +118,13 @@ namespace MapControl
label = new TextBlock { RenderTransform = renderTransform };
if (FontFamily != null)
{
- label.SetBinding(TextBlock.FontFamilyProperty, FontFamilyBinding);
+ label.SetBinding(TextBlock.FontFamilyProperty, GetBinding(FontFamilyProperty, nameof(FontFamily)));
}
- label.SetBinding(TextBlock.FontSizeProperty, FontSizeBinding);
- label.SetBinding(TextBlock.FontStyleProperty, FontStyleBinding);
- label.SetBinding(TextBlock.FontStretchProperty, FontStretchBinding);
- label.SetBinding(TextBlock.FontWeightProperty, FontWeightBinding);
- label.SetBinding(TextBlock.ForegroundProperty, ForegroundBinding);
+ label.SetBinding(TextBlock.FontSizeProperty, GetBinding(FontSizeProperty, nameof(FontSize)));
+ label.SetBinding(TextBlock.FontStyleProperty, GetBinding(FontStyleProperty, nameof(FontStyle)));
+ label.SetBinding(TextBlock.FontStretchProperty, GetBinding(FontStretchProperty, nameof(FontStretch)));
+ label.SetBinding(TextBlock.FontWeightProperty, GetBinding(FontWeightProperty, nameof(FontWeight)));
+ label.SetBinding(TextBlock.ForegroundProperty, GetBinding(ForegroundProperty, nameof(Foreground)));
Children.Add(label);
}
diff --git a/MapControl/UWP/MapOverlay.UWP.cs b/MapControl/UWP/MapOverlay.UWP.cs
index a7346306..2f8f2b30 100644
--- a/MapControl/UWP/MapOverlay.UWP.cs
+++ b/MapControl/UWP/MapOverlay.UWP.cs
@@ -4,18 +4,19 @@
using Windows.UI.Text;
using Windows.UI.Xaml;
+using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Media;
namespace MapControl
{
public partial class MapOverlay
{
- public static readonly DependencyProperty FontSizeProperty = DependencyProperty.Register(
- nameof(FontSize), typeof(double), typeof(MapOverlay), new PropertyMetadata(12d));
-
public static readonly DependencyProperty FontFamilyProperty = DependencyProperty.Register(
nameof(FontFamily), typeof(FontFamily), typeof(MapOverlay), new PropertyMetadata(null));
+ public static readonly DependencyProperty FontSizeProperty = DependencyProperty.Register(
+ nameof(FontSize), typeof(double), typeof(MapOverlay), new PropertyMetadata(12d));
+
public static readonly DependencyProperty FontStyleProperty = DependencyProperty.Register(
nameof(FontStyle), typeof(FontStyle), typeof(MapOverlay), new PropertyMetadata(FontStyle.Normal));
@@ -54,5 +55,17 @@ namespace MapControl
public static readonly DependencyProperty StrokeMiterLimitProperty = DependencyProperty.Register(
nameof(StrokeMiterLimit), typeof(double), typeof(MapOverlay), new PropertyMetadata(1d));
+
+ protected override void SetParentMap(MapBase map)
+ {
+ if (Foreground == null && map != null)
+ {
+ SetBinding(ForegroundProperty,
+ map.GetBindingExpression(MapBase.ForegroundProperty)?.ParentBinding ??
+ new Binding { Source = map, Path = new PropertyPath("Foreground") });
+ }
+
+ base.SetParentMap(map);
+ }
}
}
diff --git a/MapControl/WPF/MapOverlay.WPF.cs b/MapControl/WPF/MapOverlay.WPF.cs
index 75263b14..90b82969 100644
--- a/MapControl/WPF/MapOverlay.WPF.cs
+++ b/MapControl/WPF/MapOverlay.WPF.cs
@@ -3,7 +3,7 @@
// Licensed under the Microsoft Public License (Ms-PL)
using System.Windows;
-using System.Windows.Controls;
+using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Shapes;
@@ -11,39 +11,50 @@ namespace MapControl
{
public partial class MapOverlay
{
- public static readonly DependencyProperty FontSizeProperty = Control.FontSizeProperty.AddOwner(typeof(MapOverlay));
- public static readonly DependencyProperty FontFamilyProperty = Control.FontFamilyProperty.AddOwner(typeof(MapOverlay));
- public static readonly DependencyProperty FontStyleProperty = Control.FontStyleProperty.AddOwner(typeof(MapOverlay));
- public static readonly DependencyProperty FontStretchProperty = Control.FontStretchProperty.AddOwner(typeof(MapOverlay));
- public static readonly DependencyProperty FontWeightProperty = Control.FontWeightProperty.AddOwner(typeof(MapOverlay));
- public static readonly DependencyProperty ForegroundProperty = Control.ForegroundProperty.AddOwner(typeof(MapOverlay));
+ public static readonly DependencyProperty FontFamilyProperty = TextElement.FontFamilyProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { Inherits = true, AffectsRender = true });
- public static readonly DependencyProperty StrokeProperty = Shape.StrokeProperty.AddOwner(typeof(MapOverlay),
- new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
+ public static readonly DependencyProperty FontSizeProperty = TextElement.FontSizeProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { Inherits = true, AffectsRender = true });
- public static readonly DependencyProperty StrokeThicknessProperty = Shape.StrokeThicknessProperty.AddOwner(typeof(MapOverlay),
- new FrameworkPropertyMetadata(1d, FrameworkPropertyMetadataOptions.AffectsRender));
+ public static readonly DependencyProperty FontStyleProperty = TextElement.FontStyleProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { Inherits = true, AffectsRender = true });
- public static readonly DependencyProperty StrokeDashArrayProperty = Shape.StrokeDashArrayProperty.AddOwner(typeof(MapOverlay),
- new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
+ public static readonly DependencyProperty FontStretchProperty = TextElement.FontStretchProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { Inherits = true, AffectsRender = true });
- public static readonly DependencyProperty StrokeDashOffsetProperty = Shape.StrokeDashOffsetProperty.AddOwner(typeof(MapOverlay),
- new FrameworkPropertyMetadata(0d, FrameworkPropertyMetadataOptions.AffectsRender));
+ public static readonly DependencyProperty FontWeightProperty = TextElement.FontWeightProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { Inherits = true, AffectsRender = true });
- public static readonly DependencyProperty StrokeDashCapProperty = Shape.StrokeDashCapProperty.AddOwner(typeof(MapOverlay),
- new FrameworkPropertyMetadata(PenLineCap.Flat, FrameworkPropertyMetadataOptions.AffectsRender));
+ public static readonly DependencyProperty ForegroundProperty = TextElement.ForegroundProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { Inherits = true, AffectsRender = true, DefaultValue = null });
- public static readonly DependencyProperty StrokeStartLineCapProperty = Shape.StrokeStartLineCapProperty.AddOwner(typeof(MapOverlay),
- new FrameworkPropertyMetadata(PenLineCap.Flat, FrameworkPropertyMetadataOptions.AffectsRender));
+ public static readonly DependencyProperty StrokeProperty = Shape.StrokeProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true, DefaultValue = null });
- public static readonly DependencyProperty StrokeEndLineCapProperty = Shape.StrokeEndLineCapProperty.AddOwner(typeof(MapOverlay),
- new FrameworkPropertyMetadata(PenLineCap.Flat, FrameworkPropertyMetadataOptions.AffectsRender));
+ public static readonly DependencyProperty StrokeThicknessProperty = Shape.StrokeThicknessProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
- public static readonly DependencyProperty StrokeLineJoinProperty = Shape.StrokeLineJoinProperty.AddOwner(typeof(MapOverlay),
- new FrameworkPropertyMetadata(PenLineJoin.Miter, FrameworkPropertyMetadataOptions.AffectsRender));
+ public static readonly DependencyProperty StrokeDashArrayProperty = Shape.StrokeDashArrayProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
- public static readonly DependencyProperty StrokeMiterLimitProperty = Shape.StrokeMiterLimitProperty.AddOwner(typeof(MapOverlay),
- new FrameworkPropertyMetadata(1d, FrameworkPropertyMetadataOptions.AffectsRender));
+ public static readonly DependencyProperty StrokeDashOffsetProperty = Shape.StrokeDashOffsetProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
+
+ public static readonly DependencyProperty StrokeDashCapProperty = Shape.StrokeDashCapProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
+
+ public static readonly DependencyProperty StrokeStartLineCapProperty = Shape.StrokeStartLineCapProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
+
+ public static readonly DependencyProperty StrokeEndLineCapProperty = Shape.StrokeEndLineCapProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
+
+ public static readonly DependencyProperty StrokeLineJoinProperty = Shape.StrokeLineJoinProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
+
+ public static readonly DependencyProperty StrokeMiterLimitProperty = Shape.StrokeMiterLimitProperty.AddOwner(
+ typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
public Pen CreatePen()
{