mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 06:55:04 +00:00
Version 4.9.0: Reworked MapPanel child arrangement.
This commit is contained in:
parent
56d376c4d0
commit
5a05e9284a
5 changed files with 102 additions and 141 deletions
|
|
@ -20,31 +20,6 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public partial class MapOverlay : MapPanel
|
||||
{
|
||||
public MapOverlay()
|
||||
{
|
||||
Loaded += (s, e) =>
|
||||
{
|
||||
#if WINDOWS_UWP
|
||||
if (Foreground == null)
|
||||
{
|
||||
SetBinding(ForegroundProperty, new Binding
|
||||
{
|
||||
Source = this,
|
||||
Path = new PropertyPath("ParentMap.Foreground")
|
||||
});
|
||||
}
|
||||
#endif
|
||||
if (Stroke == null)
|
||||
{
|
||||
SetBinding(StrokeProperty, new Binding
|
||||
{
|
||||
Source = this,
|
||||
Path = new PropertyPath("Foreground")
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public double FontSize
|
||||
{
|
||||
get { return (double)GetValue(FontSizeProperty); }
|
||||
|
|
@ -134,5 +109,82 @@ namespace MapControl
|
|||
get { return (double)GetValue(StrokeMiterLimitProperty); }
|
||||
set { SetValue(StrokeMiterLimitProperty, value); }
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return GetBindingExpression(property)?.ParentBinding ??
|
||||
new Binding { Source = this, Path = new PropertyPath(propertyName) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue