Version 4.9.0: Reworked MapPanel child arrangement.

This commit is contained in:
ClemensF 2018-05-01 12:45:19 +02:00
parent ea2cd438fa
commit 452e2a5454
9 changed files with 104 additions and 172 deletions

View file

@ -168,7 +168,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
<Version>6.0.8</Version>
<Version>6.1.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>

View file

@ -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);
}

View file

@ -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);
}
}
}