diff --git a/Caching/FileDbCache/Properties/AssemblyInfo.cs b/Caching/FileDbCache/Properties/AssemblyInfo.cs
index b86c2c49..a00e8fe7 100644
--- a/Caching/FileDbCache/Properties/AssemblyInfo.cs
+++ b/Caching/FileDbCache/Properties/AssemblyInfo.cs
@@ -9,6 +9,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © 2013 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.1.5")]
-[assembly: AssemblyFileVersion("1.1.5")]
+[assembly: AssemblyVersion("1.1.6")]
+[assembly: AssemblyFileVersion("1.1.6")]
[assembly: ComVisible(false)]
diff --git a/Caching/ImageFileCache/Properties/AssemblyInfo.cs b/Caching/ImageFileCache/Properties/AssemblyInfo.cs
index 8517c59e..d254a687 100644
--- a/Caching/ImageFileCache/Properties/AssemblyInfo.cs
+++ b/Caching/ImageFileCache/Properties/AssemblyInfo.cs
@@ -9,6 +9,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © 2013 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.1.5")]
-[assembly: AssemblyFileVersion("1.1.5")]
+[assembly: AssemblyVersion("1.1.6")]
+[assembly: AssemblyFileVersion("1.1.6")]
[assembly: ComVisible(false)]
diff --git a/MapControl/MapControl.Silverlight.csproj b/MapControl/MapControl.Silverlight.csproj
index 0c4864a5..6ba9ed0f 100644
--- a/MapControl/MapControl.Silverlight.csproj
+++ b/MapControl/MapControl.Silverlight.csproj
@@ -83,7 +83,7 @@
-
+
diff --git a/MapControl/MapPolyline.Silverlight.WinRT.cs b/MapControl/MapPolyline.Silverlight.WinRT.cs
new file mode 100644
index 00000000..1bad138b
--- /dev/null
+++ b/MapControl/MapPolyline.Silverlight.WinRT.cs
@@ -0,0 +1,74 @@
+// XAML Map Control - http://xamlmapcontrol.codeplex.com/
+// Copyright © 2013 Clemens Fischer
+// Licensed under the Microsoft Public License (Ms-PL)
+
+using System.Linq;
+#if NETFX_CORE
+using Windows.UI.Xaml.Media;
+using Windows.UI.Xaml.Shapes;
+#else
+using System.Windows;
+using System.Windows.Media;
+using System.Windows.Shapes;
+#endif
+
+namespace MapControl
+{
+ public partial class MapPolyline : Path
+ {
+ protected readonly PathGeometry Geometry = new PathGeometry();
+
+ public MapPolyline()
+ {
+ Data = Geometry;
+ MapPanel.AddParentMapHandlers(this);
+ }
+
+#if SILVERLIGHT
+ // In Silverlight Path.MeasureOverride occasionally tries to create
+ // negative width or height from a transformed geometry in Path.Data.
+ protected override Size MeasureOverride(Size constraint)
+ {
+ return new Size(Geometry.Bounds.Width, Geometry.Bounds.Height);
+ }
+#endif
+
+ private void UpdateGeometry()
+ {
+ var parentMap = MapPanel.GetParentMap(this);
+ var locations = Locations;
+ Location first;
+
+ Geometry.Figures.Clear();
+
+ if (parentMap != null && locations != null && (first = locations.FirstOrDefault()) != null)
+ {
+ var figure = new PathFigure
+ {
+ StartPoint = parentMap.MapTransform.Transform(first),
+ IsClosed = IsClosed,
+ IsFilled = IsClosed
+ };
+
+ var segment = new PolyLineSegment();
+
+ foreach (var location in locations.Skip(1))
+ {
+ segment.Points.Add(parentMap.MapTransform.Transform(location));
+ }
+
+ if (segment.Points.Count > 0)
+ {
+ figure.Segments.Add(segment);
+ }
+
+ Geometry.Figures.Add(figure);
+ Geometry.Transform = parentMap.ViewportTransform;
+ }
+ else
+ {
+ Geometry.Transform = null;
+ }
+ }
+ }
+}
diff --git a/MapControl/MapPolyline.Silverlight.cs b/MapControl/MapPolyline.Silverlight.cs
deleted file mode 100644
index ee3c1682..00000000
--- a/MapControl/MapPolyline.Silverlight.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// XAML Map Control - http://xamlmapcontrol.codeplex.com/
-// Copyright © 2013 Clemens Fischer
-// Licensed under the Microsoft Public License (Ms-PL)
-
-using System.Collections.Generic;
-using System.Windows;
-using System.Windows.Shapes;
-
-namespace MapControl
-{
- public partial class MapPolyline : Path
- {
- public static readonly DependencyProperty LocationsProperty = DependencyProperty.Register(
- "Locations", typeof(ICollection), typeof(MapPolyline),
- new PropertyMetadata(null, LocationsPropertyChanged));
-
- public MapPolyline()
- {
- Data = Geometry;
- MapPanel.AddParentMapHandlers(this);
- }
-
- protected override Size MeasureOverride(Size constraint)
- {
- // MeasureOverride in Silverlight occasionally tries to create
- // negative width or height from a transformed geometry in Data.
- return new Size(Geometry.Bounds.Width, Geometry.Bounds.Height);
- }
- }
-}
diff --git a/MapControl/MapPolyline.WPF.cs b/MapControl/MapPolyline.WPF.cs
index acde6383..013d9ec0 100644
--- a/MapControl/MapPolyline.WPF.cs
+++ b/MapControl/MapPolyline.WPF.cs
@@ -3,6 +3,7 @@
// Licensed under the Microsoft Public License (Ms-PL)
using System.Collections.Generic;
+using System.Linq;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
@@ -11,13 +12,37 @@ namespace MapControl
{
public partial class MapPolyline : Shape
{
- public static readonly DependencyProperty LocationsProperty = DependencyProperty.Register(
- "Locations", typeof(ICollection), typeof(MapPolyline),
- new PropertyMetadata(null, LocationsPropertyChanged));
+ protected readonly StreamGeometry Geometry = new StreamGeometry();
protected override Geometry DefiningGeometry
{
get { return Geometry; }
}
+
+ private void UpdateGeometry()
+ {
+ var parentMap = MapPanel.GetParentMap(this);
+ var locations = Locations;
+ Location first;
+
+ if (parentMap != null && locations != null && (first = locations.FirstOrDefault()) != null)
+ {
+ using (var context = Geometry.Open())
+ {
+ var startPoint = parentMap.MapTransform.Transform(first);
+ var points = locations.Skip(1).Select(l => parentMap.MapTransform.Transform(l)).ToList();
+
+ context.BeginFigure(startPoint, IsClosed, IsClosed);
+ context.PolyLineTo(points, true, false);
+ }
+
+ Geometry.Transform = parentMap.ViewportTransform;
+ }
+ else
+ {
+ Geometry.Clear();
+ Geometry.Transform = null;
+ }
+ }
}
}
diff --git a/MapControl/MapPolyline.WinRT.cs b/MapControl/MapPolyline.WinRT.cs
deleted file mode 100644
index 0e68444d..00000000
--- a/MapControl/MapPolyline.WinRT.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// XAML Map Control - http://xamlmapcontrol.codeplex.com/
-// Copyright © 2013 Clemens Fischer
-// Licensed under the Microsoft Public License (Ms-PL)
-
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Shapes;
-
-namespace MapControl
-{
- public partial class MapPolyline : Path
- {
- ///
- /// Property type declared as object instead of IEnumerable.
- /// See here: http://stackoverflow.com/q/10544084/1136211
- ///
- public static readonly DependencyProperty LocationsProperty = DependencyProperty.Register(
- "Locations", typeof(object), typeof(MapPolyline),
- new PropertyMetadata(null, LocationsPropertyChanged));
-
- public MapPolyline()
- {
- Data = Geometry;
- MapPanel.AddParentMapHandlers(this);
- }
- }
-}
diff --git a/MapControl/MapPolyline.cs b/MapControl/MapPolyline.cs
index 9eb3f986..5ad4fd24 100644
--- a/MapControl/MapPolyline.cs
+++ b/MapControl/MapPolyline.cs
@@ -3,27 +3,33 @@
// Licensed under the Microsoft Public License (Ms-PL)
using System;
-using System.Linq;
using System.Collections.Generic;
using System.Collections.Specialized;
#if NETFX_CORE
using Windows.UI.Xaml;
-using Windows.UI.Xaml.Media;
#else
using System.Windows;
-using System.Windows.Media;
#endif
namespace MapControl
{
public partial class MapPolyline : IMapElement
{
+#if NETFX_CORE
+ // For WinRT, the Locations dependency property type is declared as object
+ // instead of IEnumerable. See http://stackoverflow.com/q/10544084/1136211
+ private static readonly Type LocationsPropertyType = typeof(object);
+#else
+ private static readonly Type LocationsPropertyType = typeof(IEnumerable);
+#endif
+ public static readonly DependencyProperty LocationsProperty = DependencyProperty.Register(
+ "Locations", LocationsPropertyType, typeof(MapPolyline),
+ new PropertyMetadata(null, LocationsPropertyChanged));
+
public static readonly DependencyProperty IsClosedProperty = DependencyProperty.Register(
"IsClosed", typeof(bool), typeof(MapPolyline),
new PropertyMetadata(false, (o, e) => ((MapPolyline)o).UpdateGeometry()));
- protected readonly PathGeometry Geometry = new PathGeometry();
-
///
/// Gets or sets the locations that define the polyline points.
///
@@ -42,44 +48,6 @@ namespace MapControl
set { SetValue(IsClosedProperty, value); }
}
- private void UpdateGeometry()
- {
- var parentMap = MapPanel.GetParentMap(this);
- var locations = Locations;
- Location first;
-
- Geometry.Figures.Clear();
-
- if (parentMap != null && locations != null && (first = locations.FirstOrDefault()) != null)
- {
- var figure = new PathFigure
- {
- StartPoint = parentMap.MapTransform.Transform(first),
- IsClosed = IsClosed,
- IsFilled = IsClosed
- };
-
- var segment = new PolyLineSegment();
-
- foreach (var location in locations.Skip(1))
- {
- segment.Points.Add(parentMap.MapTransform.Transform(location));
- }
-
- if (segment.Points.Count > 0)
- {
- figure.Segments.Add(segment);
- }
-
- Geometry.Figures.Add(figure);
- Geometry.Transform = parentMap.ViewportTransform;
- }
- else
- {
- Geometry.Transform = null;
- }
- }
-
void IMapElement.ParentMapChanged(MapBase oldParentMap, MapBase newParentMap)
{
UpdateGeometry();
diff --git a/MapControl/Properties/AssemblyInfo.cs b/MapControl/Properties/AssemblyInfo.cs
index 0a1d1f40..92b34e56 100644
--- a/MapControl/Properties/AssemblyInfo.cs
+++ b/MapControl/Properties/AssemblyInfo.cs
@@ -16,6 +16,6 @@ using System.Windows;
[assembly: AssemblyCopyright("Copyright © 2013 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.1.5")]
-[assembly: AssemblyFileVersion("1.1.5")]
+[assembly: AssemblyVersion("1.1.6")]
+[assembly: AssemblyFileVersion("1.1.6")]
[assembly: ComVisible(false)]
diff --git a/MapControl/WinRT/MapControl.WinRT.csproj b/MapControl/WinRT/MapControl.WinRT.csproj
index 2befaf09..392c8d1a 100644
--- a/MapControl/WinRT/MapControl.WinRT.csproj
+++ b/MapControl/WinRT/MapControl.WinRT.csproj
@@ -87,8 +87,8 @@
MapPolyline.cs
-
- MapPolyline.WinRT.cs
+
+ MapPolyline.Silverlight.WinRT.cs
MapTransform.cs
diff --git a/MapControl/WinRT/Properties/AssemblyInfo.cs b/MapControl/WinRT/Properties/AssemblyInfo.cs
index dc0832d5..81f4e190 100644
--- a/MapControl/WinRT/Properties/AssemblyInfo.cs
+++ b/MapControl/WinRT/Properties/AssemblyInfo.cs
@@ -9,6 +9,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © 2013 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.1.5")]
-[assembly: AssemblyFileVersion("1.1.5")]
+[assembly: AssemblyVersion("1.1.6")]
+[assembly: AssemblyFileVersion("1.1.6")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
index 05cd478e..7d37655a 100644
--- a/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
+++ b/SampleApps/SilverlightApplication.Web/Properties/AssemblyInfo.cs
@@ -9,6 +9,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © 2013 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.1.5")]
-[assembly: AssemblyFileVersion("1.1.5")]
+[assembly: AssemblyVersion("1.1.6")]
+[assembly: AssemblyFileVersion("1.1.6")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs b/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs
index 8cb1afeb..b2ea4cb2 100644
--- a/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs
+++ b/SampleApps/SilverlightApplication/Properties/AssemblyInfo.cs
@@ -9,6 +9,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © 2013 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.1.5")]
-[assembly: AssemblyFileVersion("1.1.5")]
+[assembly: AssemblyVersion("1.1.6")]
+[assembly: AssemblyFileVersion("1.1.6")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/StoreApplication/Properties/AssemblyInfo.cs b/SampleApps/StoreApplication/Properties/AssemblyInfo.cs
index 176f4fd8..9b68c0cd 100644
--- a/SampleApps/StoreApplication/Properties/AssemblyInfo.cs
+++ b/SampleApps/StoreApplication/Properties/AssemblyInfo.cs
@@ -9,6 +9,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © 2013 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.1.5")]
-[assembly: AssemblyFileVersion("1.1.5")]
+[assembly: AssemblyVersion("1.1.6")]
+[assembly: AssemblyFileVersion("1.1.6")]
[assembly: ComVisible(false)]
diff --git a/SampleApps/SurfaceApplication/Properties/AssemblyInfo.cs b/SampleApps/SurfaceApplication/Properties/AssemblyInfo.cs
index 77b389fe..ebfb5829 100644
--- a/SampleApps/SurfaceApplication/Properties/AssemblyInfo.cs
+++ b/SampleApps/SurfaceApplication/Properties/AssemblyInfo.cs
@@ -10,7 +10,7 @@ using System.Windows;
[assembly: AssemblyCopyright("Copyright © 2013 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.1.5")]
-[assembly: AssemblyFileVersion("1.1.5")]
+[assembly: AssemblyVersion("1.1.6")]
+[assembly: AssemblyFileVersion("1.1.6")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
diff --git a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs
index a8c9721f..c8fbe4b2 100644
--- a/SampleApps/WpfApplication/Properties/AssemblyInfo.cs
+++ b/SampleApps/WpfApplication/Properties/AssemblyInfo.cs
@@ -10,7 +10,7 @@ using System.Windows;
[assembly: AssemblyCopyright("Copyright © 2013 Clemens Fischer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.1.5")]
-[assembly: AssemblyFileVersion("1.1.5")]
+[assembly: AssemblyVersion("1.1.6")]
+[assembly: AssemblyFileVersion("1.1.6")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]