mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 06:26:41 +00:00
Version 4.7.1: Fixed MapOverlay Foreground and Stroke.
This commit is contained in:
parent
9566c2d708
commit
de4ba0765a
13 changed files with 84 additions and 111 deletions
|
|
@ -4,9 +4,12 @@
|
|||
|
||||
#if WINDOWS_UWP
|
||||
using Windows.UI.Text;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Media;
|
||||
#else
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
#endif
|
||||
|
||||
|
|
@ -17,6 +20,21 @@ namespace MapControl
|
|||
/// </summary>
|
||||
public partial class MapOverlay : MapPanel
|
||||
{
|
||||
public MapOverlay()
|
||||
{
|
||||
Loaded += (s, e) =>
|
||||
{
|
||||
if (Stroke == null)
|
||||
{
|
||||
SetBinding(StrokeProperty, new Binding
|
||||
{
|
||||
Source = this,
|
||||
Path = new PropertyPath("Foreground")
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public double FontSize
|
||||
{
|
||||
get { return (double)GetValue(FontSizeProperty); }
|
||||
|
|
|
|||
|
|
@ -43,29 +43,27 @@ namespace MapControl
|
|||
label.VerticalAlignment = VerticalAlignment.Top;
|
||||
label.TextAlignment = TextAlignment.Center;
|
||||
|
||||
label.SetBinding(TextBlock.ForegroundProperty,
|
||||
GetBindingExpression(ForegroundProperty)?.ParentBinding ??
|
||||
new Binding
|
||||
{
|
||||
Source = this,
|
||||
Path = new PropertyPath("Foreground")
|
||||
});
|
||||
label.SetBinding(TextBlock.ForegroundProperty, new Binding
|
||||
{
|
||||
Source = this,
|
||||
Path = new PropertyPath("Foreground")
|
||||
});
|
||||
|
||||
line.SetBinding(Shape.StrokeProperty,
|
||||
GetBindingExpression(StrokeProperty)?.ParentBinding ??
|
||||
new Binding
|
||||
{
|
||||
Source = this,
|
||||
Path = new PropertyPath("Stroke")
|
||||
});
|
||||
|
||||
line.SetBinding(Shape.StrokeThicknessProperty,
|
||||
GetBindingExpression(StrokeThicknessProperty)?.ParentBinding ??
|
||||
new Binding
|
||||
{
|
||||
Source = this,
|
||||
Path = new PropertyPath("StrokeThickness")
|
||||
});
|
||||
|
||||
line.SetBinding(Shape.StrokeProperty, new Binding
|
||||
{
|
||||
Source = this,
|
||||
Path = new PropertyPath("Stroke")
|
||||
});
|
||||
|
||||
|
||||
|
||||
line.SetBinding(Shape.StrokeThicknessProperty, new Binding
|
||||
{
|
||||
Source = this,
|
||||
Path = new PropertyPath("StrokeThickness")
|
||||
});
|
||||
|
||||
Children.Add(line);
|
||||
Children.Add(label);
|
||||
|
|
@ -106,13 +104,15 @@ namespace MapControl
|
|||
var x2 = size.Width - Padding.Right - StrokeThickness / 2d;
|
||||
var y1 = size.Height / 2d;
|
||||
var y2 = size.Height - Padding.Bottom - StrokeThickness / 2d;
|
||||
var points = new PointCollection();
|
||||
points.Add(new Point(x1, y1));
|
||||
points.Add(new Point(x1, y2));
|
||||
points.Add(new Point(x2, y2));
|
||||
points.Add(new Point(x2, y1));
|
||||
|
||||
line.Points = points;
|
||||
line.Points = new PointCollection
|
||||
{
|
||||
new Point(x1, y1),
|
||||
new Point(x1, y2),
|
||||
new Point(x2, y2),
|
||||
new Point(x2, y1)
|
||||
};
|
||||
|
||||
line.Measure(size);
|
||||
|
||||
if (FontFamily != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue