Workaround for Locations property type in MapPolyline.

This commit is contained in:
ClemensF 2013-01-03 17:07:59 +01:00
parent 452e039349
commit 8e85aa8e17
5 changed files with 21 additions and 5 deletions

View file

@ -2,6 +2,7 @@
// Copyright © 2012 Clemens Fischer // Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL) // Licensed under the Microsoft Public License (Ms-PL)
using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Shapes; using System.Windows.Shapes;
@ -9,6 +10,10 @@ namespace MapControl
{ {
public partial class MapPolyline : Path public partial class MapPolyline : Path
{ {
public static readonly DependencyProperty LocationsProperty = DependencyProperty.Register(
"Locations", typeof(ICollection<Location>), typeof(MapPolyline),
new PropertyMetadata(null, LocationsPropertyChanged));
public MapPolyline() public MapPolyline()
{ {
Data = Geometry; Data = Geometry;

View file

@ -2,6 +2,7 @@
// Copyright © 2012 Clemens Fischer // Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL) // Licensed under the Microsoft Public License (Ms-PL)
using System.Collections.Generic;
using System.Windows; using System.Windows;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Shapes; using System.Windows.Shapes;
@ -10,6 +11,10 @@ namespace MapControl
{ {
public partial class MapPolyline : Shape public partial class MapPolyline : Shape
{ {
public static readonly DependencyProperty LocationsProperty = DependencyProperty.Register(
"Locations", typeof(ICollection<Location>), typeof(MapPolyline),
new PropertyMetadata(null, LocationsPropertyChanged));
protected override Geometry DefiningGeometry protected override Geometry DefiningGeometry
{ {
get { return Geometry; } get { return Geometry; }

View file

@ -2,12 +2,21 @@
// Copyright © 2012 Clemens Fischer // Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL) // Licensed under the Microsoft Public License (Ms-PL)
using Windows.UI.Xaml;
using Windows.UI.Xaml.Shapes; using Windows.UI.Xaml.Shapes;
namespace MapControl namespace MapControl
{ {
public partial class MapPolyline : Path public partial class MapPolyline : Path
{ {
/// <summary>
/// Property type declared as object instead of IEnumerable.
/// See here: http://stackoverflow.com/q/10544084/1136211
/// </summary>
public static readonly DependencyProperty LocationsProperty = DependencyProperty.Register(
"Locations", typeof(object), typeof(MapPolyline),
new PropertyMetadata(null, LocationsPropertyChanged));
public MapPolyline() public MapPolyline()
{ {
Data = Geometry; Data = Geometry;

View file

@ -2,6 +2,7 @@
// Copyright © 2012 Clemens Fischer // Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL) // Licensed under the Microsoft Public License (Ms-PL)
using System;
using System.Linq; using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
@ -17,10 +18,6 @@ namespace MapControl
{ {
public partial class MapPolyline : IMapElement public partial class MapPolyline : IMapElement
{ {
public static readonly DependencyProperty LocationsProperty = DependencyProperty.Register(
"Locations", typeof(IEnumerable<Location>), typeof(MapPolyline),
new PropertyMetadata(null, LocationsPropertyChanged));
public static readonly DependencyProperty IsClosedProperty = DependencyProperty.Register( public static readonly DependencyProperty IsClosedProperty = DependencyProperty.Register(
"IsClosed", typeof(bool), typeof(MapPolyline), "IsClosed", typeof(bool), typeof(MapPolyline),
new PropertyMetadata(false, (o, e) => ((MapPolyline)o).UpdateGeometry())); new PropertyMetadata(false, (o, e) => ((MapPolyline)o).UpdateGeometry()));

View file

@ -25,7 +25,7 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>none</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\bin\Release\</OutputPath> <OutputPath>..\bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants> <DefineConstants>TRACE;NETFX_CORE</DefineConstants>