Version 4.9.0: Reworked MapPanel child arrangement.

This commit is contained in:
ClemensF 2018-05-01 12:59:47 +02:00
parent ff013ccf86
commit 4608909ca9
3 changed files with 16 additions and 13 deletions

View file

@ -10,9 +10,7 @@ using Windows.UI.Xaml.Media;
#else #else
using System.Windows; using System.Windows;
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Shapes;
#endif #endif
namespace MapControl namespace MapControl
@ -22,17 +20,6 @@ namespace MapControl
/// </summary> /// </summary>
public partial class MapOverlay : MapPanel public partial class MapOverlay : MapPanel
{ {
public MapOverlay()
{
Loaded += (s, e) =>
{
if (Stroke == null)
{
SetBinding(StrokeProperty, GetBinding(ForegroundProperty, nameof(Foreground)));
}
};
}
public FontFamily FontFamily public FontFamily FontFamily
{ {
get { return (FontFamily)GetValue(FontFamilyProperty); } get { return (FontFamily)GetValue(FontFamilyProperty); }

View file

@ -65,6 +65,11 @@ namespace MapControl
new Binding { Source = map, Path = new PropertyPath("Foreground") }); new Binding { Source = map, Path = new PropertyPath("Foreground") });
} }
if (Stroke == null)
{
SetBinding(StrokeProperty, GetBinding(ForegroundProperty, nameof(Foreground)));
}
base.SetParentMap(map); base.SetParentMap(map);
} }
} }

View file

@ -56,6 +56,17 @@ namespace MapControl
public static readonly DependencyProperty StrokeMiterLimitProperty = Shape.StrokeMiterLimitProperty.AddOwner( public static readonly DependencyProperty StrokeMiterLimitProperty = Shape.StrokeMiterLimitProperty.AddOwner(
typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true }); typeof(MapOverlay), new FrameworkPropertyMetadata { AffectsRender = true });
public MapOverlay()
{
Loaded += (s, e) =>
{
if (Stroke == null)
{
SetBinding(StrokeProperty, GetBinding(ForegroundProperty, nameof(Foreground)));
}
};
}
public Pen CreatePen() public Pen CreatePen()
{ {
return new Pen return new Pen