PushpinBorder for all platforms

This commit is contained in:
Clemens 2022-02-05 15:52:17 +01:00
parent 4a38e1e1e9
commit a4f19a5976
16 changed files with 291 additions and 164 deletions

View file

@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

View file

@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

View file

@ -0,0 +1,115 @@
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2022 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using System;
#if WINUI
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Windows.Foundation;
#elif UWP
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
#else
using System.Windows;
using System.Windows.Media;
#endif
namespace MapControl
{
public partial class PushpinBorder
{
public Size ArrowSize
{
get { return (Size)GetValue(ArrowSizeProperty); }
set { SetValue(ArrowSizeProperty, value); }
}
public double BorderWidth
{
get { return (double)GetValue(BorderWidthProperty); }
set { SetValue(BorderWidthProperty, value); }
}
protected virtual Geometry BuildGeometry()
{
var width = Math.Floor(RenderSize.Width);
var height = Math.Floor(RenderSize.Height);
var x1 = BorderWidth / 2d;
var y1 = BorderWidth / 2d;
var x2 = width - x1;
var y3 = height - y1;
var y2 = y3 - ArrowSize.Height;
var aw = ArrowSize.Width;
var r1 = CornerRadius.TopLeft;
var r2 = CornerRadius.TopRight;
var r3 = CornerRadius.BottomRight;
var r4 = CornerRadius.BottomLeft;
var figure = new PathFigure
{
StartPoint = new Point(x1, y1 + r1),
IsClosed = true,
IsFilled = true
};
figure.Segments.Add(ArcTo(x1 + r1, y1, r1));
figure.Segments.Add(LineTo(x2 - r2, y1));
figure.Segments.Add(ArcTo(x2, y1 + r2, r2));
if (HorizontalAlignment == HorizontalAlignment.Right)
{
figure.Segments.Add(LineTo(x2, y3));
figure.Segments.Add(LineTo(x2 - aw, y2));
}
else
{
figure.Segments.Add(LineTo(x2, y2 - r3));
figure.Segments.Add(ArcTo(x2 - r3, y2, r3));
}
if (HorizontalAlignment != HorizontalAlignment.Left && HorizontalAlignment != HorizontalAlignment.Right)
{
var c = width / 2d;
figure.Segments.Add(LineTo(c + aw / 2d, y2));
figure.Segments.Add(LineTo(c, y3));
figure.Segments.Add(LineTo(c - aw / 2d, y2));
}
if (HorizontalAlignment == HorizontalAlignment.Left)
{
figure.Segments.Add(LineTo(x1 + aw, y2));
figure.Segments.Add(LineTo(x1, y3));
}
else
{
figure.Segments.Add(LineTo(x1 + r4, y2));
figure.Segments.Add(ArcTo(x1, y2 - r4, r4));
}
var geometry = new PathGeometry();
geometry.Figures.Add(figure);
return geometry;
}
private static LineSegment LineTo(double x, double y)
{
return new LineSegment
{
Point = new Point(x, y)
};
}
private static ArcSegment ArcTo(double x, double y, double r)
{
return new ArcSegment
{
Point = new Point(x, y),
Size = new Size(r, r),
SweepDirection = SweepDirection.Clockwise
};
}
}
}

View file

@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@ -140,6 +140,9 @@
<Compile Include="..\Shared\OrthographicProjection.cs">
<Link>OrthographicProjection.cs</Link>
</Compile>
<Compile Include="..\Shared\PushpinBorder.cs">
<Link>PushpinBorder.cs</Link>
</Compile>
<Compile Include="..\Shared\StereographicProjection.cs">
<Link>StereographicProjection.cs</Link>
</Compile>
@ -233,6 +236,9 @@
<Compile Include="..\WinUI\Point.WinUI.cs">
<Link>Point.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\PushpinBorder.WinUI.cs">
<Link>PushpinBorder.WinUI.cs</Link>
</Compile>
<Compile Include="..\WinUI\Tile.WinUI.cs">
<Link>Tile.WinUI.cs</Link>
</Compile>

View file

@ -49,31 +49,24 @@
<Style TargetType="map:Pushpin" BasedOn="{StaticResource ContentControlStyle}">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Padding" Value="5,3"/>
<Setter Property="Padding" Value="5,7"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="map:Pushpin">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1">
<ContentPresenter Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
</Border>
<Path Grid.Row="1"
Data="M0.5,-1.2 L0.5,15 10,-1.2"
Fill="{TemplateBinding Background}"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="1"/>
</Grid>
<map:PushpinBorder
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderWidth="1"
CornerRadius="5">
<ContentPresenter
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</map:PushpinBorder>
</ControlTemplate>
</Setter.Value>
</Setter>

View file

@ -9,8 +9,18 @@ using System.Windows.Media;
namespace MapControl
{
public class PushpinBorder : Decorator
public partial class PushpinBorder : Decorator
{
public static readonly DependencyProperty ArrowSizeProperty = DependencyProperty.Register(
nameof(ArrowSize), typeof(Size), typeof(PushpinBorder),
new FrameworkPropertyMetadata(new Size(10d, 20d),
FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty BorderWidthProperty = DependencyProperty.Register(
nameof(BorderWidth), typeof(double), typeof(PushpinBorder),
new FrameworkPropertyMetadata(0d,
FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty BackgroundProperty = DependencyProperty.Register(
nameof(Background), typeof(Brush), typeof(PushpinBorder),
new FrameworkPropertyMetadata(null,
@ -21,11 +31,6 @@ namespace MapControl
new FrameworkPropertyMetadata(null,
FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty BorderThicknessProperty = DependencyProperty.Register(
nameof(BorderThickness), typeof(double), typeof(PushpinBorder),
new FrameworkPropertyMetadata(0d,
FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register(
nameof(CornerRadius), typeof(CornerRadius), typeof(PushpinBorder),
new FrameworkPropertyMetadata(new CornerRadius(),
@ -36,11 +41,6 @@ namespace MapControl
new FrameworkPropertyMetadata(new Thickness(2),
FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty ArrowSizeProperty = DependencyProperty.Register(
nameof(ArrowSize), typeof(Size), typeof(PushpinBorder),
new FrameworkPropertyMetadata(new Size(10d, 20d),
FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender));
public Brush Background
{
get { return (Brush)GetValue(BackgroundProperty); }
@ -53,12 +53,6 @@ namespace MapControl
set { SetValue(BorderBrushProperty, value); }
}
public double BorderThickness
{
get { return (double)GetValue(BorderThicknessProperty); }
set { SetValue(BorderThicknessProperty, value); }
}
public CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
@ -71,16 +65,10 @@ namespace MapControl
set { SetValue(PaddingProperty, value); }
}
public Size ArrowSize
{
get { return (Size)GetValue(ArrowSizeProperty); }
set { SetValue(ArrowSizeProperty, value); }
}
protected override Size MeasureOverride(Size constraint)
{
var width = Padding.Left + Padding.Right;
var height = Padding.Top + Padding.Bottom;
var width = 2d * BorderWidth + Padding.Left + Padding.Right;
var height = 2d * BorderWidth + Padding.Top + Padding.Bottom;
if (Child != null)
{
@ -89,17 +77,17 @@ namespace MapControl
height += Child.DesiredSize.Height;
}
var minWidth = Math.Max(
var minWidth = BorderWidth + Math.Max(
CornerRadius.TopLeft + CornerRadius.TopRight,
CornerRadius.BottomLeft + CornerRadius.BottomRight + ArrowSize.Width);
var minHeight = Math.Max(
var minHeight = BorderWidth + Math.Max(
CornerRadius.TopLeft + CornerRadius.BottomLeft,
CornerRadius.TopRight + CornerRadius.BottomRight);
return new Size(
Math.Max(width, minWidth) + BorderThickness,
Math.Max(height, minHeight) + BorderThickness + ArrowSize.Height);
Math.Max(width, minWidth),
Math.Max(height, minHeight) + ArrowSize.Height);
}
protected override Size ArrangeOverride(Size size)
@ -107,7 +95,10 @@ namespace MapControl
if (Child != null)
{
Child.Arrange(new Rect(
Padding.Left, Padding.Top, size.Width - Padding.Right, size.Height - Padding.Bottom));
BorderWidth + Padding.Left,
BorderWidth + Padding.Top,
size.Width - BorderWidth - Padding.Right,
size.Height - BorderWidth - Padding.Bottom));
}
return size;
@ -118,91 +109,13 @@ namespace MapControl
var pen = new Pen
{
Brush = BorderBrush,
Thickness = BorderThickness,
Thickness = BorderWidth,
LineJoin = PenLineJoin.Round
};
drawingContext.DrawGeometry(Background, pen, BuildGeometry(RenderSize));
drawingContext.DrawGeometry(Background, pen, BuildGeometry());
base.OnRender(drawingContext);
}
private Geometry BuildGeometry(Size size)
{
var x1 = BorderThickness / 2d;
var y1 = BorderThickness / 2d;
var x2 = size.Width - x1;
var y3 = size.Height - y1;
var y2 = y3 - ArrowSize.Height;
var aw = ArrowSize.Width;
var r1 = CornerRadius.TopLeft;
var r2 = CornerRadius.TopRight;
var r3 = CornerRadius.BottomRight;
var r4 = CornerRadius.BottomLeft;
var figure = new PathFigure
{
StartPoint = new Point(x1, y1 + r1),
IsClosed = true,
IsFilled = true
};
figure.Segments.Add(ArcTo(x1 + r1, y1, r1));
figure.Segments.Add(LineTo(x2 - r2, y1));
figure.Segments.Add(ArcTo(x2, y1 + r2, r2));
if (HorizontalAlignment == HorizontalAlignment.Right)
{
figure.Segments.Add(LineTo(x2, y3));
figure.Segments.Add(LineTo(x2 - aw, y2));
}
else
{
figure.Segments.Add(LineTo(x2, y2 - r3));
figure.Segments.Add(ArcTo(x2 - r3, y2, r3));
}
if (HorizontalAlignment != HorizontalAlignment.Left && HorizontalAlignment != HorizontalAlignment.Right)
{
var c = size.Width / 2d;
figure.Segments.Add(LineTo(c + aw / 2d, y2));
figure.Segments.Add(LineTo(c, y3));
figure.Segments.Add(LineTo(c - aw / 2d, y2));
}
if (HorizontalAlignment == HorizontalAlignment.Left)
{
figure.Segments.Add(LineTo(x1 + aw, y2));
figure.Segments.Add(LineTo(x1, y3));
}
else
{
figure.Segments.Add(LineTo(x1 + r4, y2));
figure.Segments.Add(ArcTo(x1, y2 - r4, r4));
}
var geometry = new PathGeometry();
geometry.Figures.Add(figure);
return geometry;
}
private static LineSegment LineTo(double x, double y)
{
return new LineSegment
{
Point = new Point(x, y)
};
}
private static ArcSegment ArcTo(double x, double y, double r)
{
return new ArcSegment
{
Point = new Point(x, y),
Size = new Size(r, r),
SweepDirection = SweepDirection.Clockwise
};
}
}
}

View file

@ -62,7 +62,7 @@
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1"
BorderWidth="1"
CornerRadius="5">
<ContentPresenter
Content="{TemplateBinding Content}"

View file

@ -26,8 +26,18 @@
<Compile Include="..\Shared\*.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="PushpinBorder.xaml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.196" />
</ItemGroup>
<ItemGroup>
<Page Update="PushpinBorder.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
</Project>

View file

@ -0,0 +1,93 @@
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2022 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using Windows.Foundation;
#if WINUI
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Markup;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Shapes;
#else
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Markup;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Shapes;
#endif
namespace MapControl
{
[ContentProperty(Name = "Child")]
public partial class PushpinBorder : UserControl
{
public static readonly DependencyProperty ArrowSizeProperty = DependencyProperty.Register(
nameof(ArrowSize), typeof(Size), typeof(PushpinBorder),
new PropertyMetadata(new Size(10d, 20d), (o, e) => ((PushpinBorder)o).SetBorderMargin()));
public static readonly DependencyProperty BorderWidthProperty = DependencyProperty.Register(
nameof(BorderWidth), typeof(double), typeof(PushpinBorder),
new PropertyMetadata(0d, (o, e) => ((PushpinBorder)o).SetBorderMargin()));
private readonly Border border = new Border();
public PushpinBorder()
{
var path = new Path
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Stretch = Stretch.None
};
path.SetBinding(Shape.FillProperty, new Binding
{
Path = new PropertyPath("Background"),
Source = this
});
path.SetBinding(Shape.StrokeProperty, new Binding
{
Path = new PropertyPath("BorderBrush"),
Source = this
});
path.SetBinding(Shape.StrokeThicknessProperty, new Binding
{
Path = new PropertyPath("BorderThickness"),
Source = this
});
border.SetBinding(PaddingProperty, new Binding
{
Path = new PropertyPath("Padding"),
Source = this
});
SetBorderMargin();
var grid = new Grid();
grid.Children.Add(path);
grid.Children.Add(border);
Content = grid;
SizeChanged += (s, e) => path.Data = BuildGeometry();
}
public UIElement Child
{
get { return border.Child; }
set { border.Child = value; }
}
private void SetBorderMargin()
{
border.Margin = new Thickness(
BorderWidth, BorderWidth, BorderWidth, BorderWidth + ArrowSize.Height);
}
}
}

View file

@ -49,31 +49,24 @@
<Style TargetType="map:Pushpin" BasedOn="{StaticResource ContentControlStyle}">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Padding" Value="5,3"/>
<Setter Property="Padding" Value="7,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="map:Pushpin">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1">
<ContentPresenter Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
</Border>
<Path Grid.Row="1"
Data="M0.5,-1.2 L0.5,15 10,-1.2"
Fill="{TemplateBinding Background}"
Stroke="{TemplateBinding BorderBrush}"
StrokeThickness="1"/>
</Grid>
<map:PushpinBorder
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
Padding="{TemplateBinding Padding}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderWidth="1"
CornerRadius="5">
<ContentPresenter
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</map:PushpinBorder>
</ControlTemplate>
</Setter.Value>
</Setter>

View file

@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

View file

@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

View file

@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

View file

@ -69,11 +69,13 @@
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
<Setter Property="AutoCollapse" Value="True"/>
<Setter Property="LocationMemberPath" Value="Location"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="map:MapItem">
<map:Pushpin Content="{Binding Name}"/>
<map:Pushpin Content="{Binding Name}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"/>
</ControlTemplate>
</Setter.Value>
</Setter>

View file

@ -12,7 +12,7 @@
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>
<FileAlignment>512</FileAlignment>

View file

@ -69,11 +69,13 @@
<Style x:Key="PushpinItemStyle" TargetType="map:MapItem">
<Setter Property="AutoCollapse" Value="True"/>
<Setter Property="LocationMemberPath" Value="Location"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="map:MapItem">
<map:Pushpin Content="{Binding Name}"/>
<map:Pushpin Content="{Binding Name}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"/>
</ControlTemplate>
</Setter.Value>
</Setter>