Removed LocationPath property from MapItem and PushPin.

This commit is contained in:
ClemensF 2012-12-06 23:28:12 +01:00
parent b0ecd850a2
commit d0d949c9be
17 changed files with 88 additions and 133 deletions

View file

@ -75,7 +75,6 @@
<Compile Include="MapBase.Silverlight.WinRT.cs" />
<Compile Include="MapGraticule.cs" />
<Compile Include="MapGraticule.Silverlight.WinRT.cs" />
<Compile Include="MapItem.cs" />
<Compile Include="MapItem.Silverlight.WinRT.cs" />
<Compile Include="MapItemsControl.cs" />
<Compile Include="MapItemsControl.Silverlight.WinRT.cs" />
@ -89,7 +88,6 @@
<Compile Include="MatrixEx.cs" />
<Compile Include="MercatorTransform.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Pushpin.cs" />
<Compile Include="Pushpin.Silverlight.WinRT.cs" />
<Compile Include="Tile.cs" />
<Compile Include="Tile.Silverlight.WinRT.cs" />

View file

@ -57,7 +57,6 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="MapBase.WPF.cs" />
<Compile Include="MapItem.cs" />
<Compile Include="MapItem.WPF.cs" />
<Compile Include="MapItemsControl.cs" />
<Compile Include="MapItemsControl.WPF.cs" />
@ -68,7 +67,6 @@
<Compile Include="MapTransform.cs" />
<Compile Include="MercatorTransform.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Pushpin.cs" />
<Compile Include="Pushpin.WPF.cs" />
<Compile Include="Tile.cs" />
<Compile Include="Tile.WPF.cs" />

View file

@ -2,9 +2,18 @@
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
#if WINRT
using Windows.UI.Xaml.Controls;
#else
using System.Windows.Controls;
#endif
namespace MapControl
{
public partial class MapItem
/// <summary>
/// Container class for an item in a MapItemsControl.
/// </summary>
public class MapItem : ListBoxItem
{
public MapItem()
{

View file

@ -7,9 +7,12 @@ using System.Windows.Controls;
namespace MapControl
{
/// <summary>
/// Container class for an item in a MapItemsControl.
/// </summary>
[TemplateVisualState(Name = "NotCurrent", GroupName = "CurrentStates")]
[TemplateVisualState(Name = "Current", GroupName = "CurrentStates")]
public partial class MapItem
public class MapItem : ListBoxItem
{
public static readonly DependencyProperty IsCurrentProperty = MapItemsControl.IsCurrentProperty.AddOwner(
typeof(MapItem),

View file

@ -1,49 +0,0 @@
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
#if WINRT
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
#else
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
#endif
namespace MapControl
{
/// <summary>
/// Container class for an item in a MapItemsControl.
/// </summary>
public partial class MapItem : ListBoxItem
{
public static readonly DependencyProperty LocationPathProperty = DependencyProperty.Register(
"LocationPath", typeof(string), typeof(MapItem), new PropertyMetadata(null, LocationPathPropertyChanged));
/// <summary>
/// Gets or sets the property path that is used to bind the MapPanel.Location attached property.
/// </summary>
public string LocationPath
{
get { return (string)GetValue(LocationPathProperty); }
set { SetValue(LocationPathProperty, value); }
}
private static void LocationPathPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
string path = e.NewValue as string;
if (!string.IsNullOrWhiteSpace(path))
{
var binding = new Binding
{
Path = new PropertyPath(path)
};
BindingOperations.SetBinding(obj, MapPanel.LocationProperty, binding);
}
}
}
}

View file

@ -2,9 +2,18 @@
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
#if WINRT
using Windows.UI.Xaml.Controls;
#else
using System.Windows.Controls;
#endif
namespace MapControl
{
public partial class Pushpin
/// <summary>
/// Displays a pushpin at a geographic location provided by the MapPanel.Location attached property.
/// </summary>
public class Pushpin : ContentControl
{
public Pushpin()
{

View file

@ -3,10 +3,14 @@
// Licensed under the Microsoft Public License (Ms-PL)
using System.Windows;
using System.Windows.Controls;
namespace MapControl
{
public partial class Pushpin
/// <summary>
/// Displays a pushpin at a geographic location provided by the MapPanel.Location attached property.
/// </summary>
public class Pushpin : ContentControl
{
static Pushpin()
{

View file

@ -1,49 +0,0 @@
// XAML Map Control - http://xamlmapcontrol.codeplex.com/
// Copyright © 2012 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
#if WINRT
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
#else
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
#endif
namespace MapControl
{
/// <summary>
/// Displays a pushpin at a geographic location provided by the MapPanel.Location attached property.
/// </summary>
public partial class Pushpin : ContentControl
{
public static readonly DependencyProperty LocationPathProperty = DependencyProperty.Register(
"LocationPath", typeof(string), typeof(Pushpin), new PropertyMetadata(null, LocationPathPropertyChanged));
/// <summary>
/// Gets or sets the property path that is used to bind the MapPanel.Location attached property.
/// </summary>
public string LocationPath
{
get { return (string)GetValue(LocationPathProperty); }
set { SetValue(LocationPathProperty, value); }
}
private static void LocationPathPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
string path = e.NewValue as string;
if (!string.IsNullOrWhiteSpace(path))
{
var binding = new Binding
{
Path = new PropertyPath(path)
};
BindingOperations.SetBinding(obj, MapPanel.LocationProperty, binding);
}
}
}
}

View file

@ -217,8 +217,8 @@ namespace MapControl
var request = (HttpWebRequest)WebRequest.Create(uri);
request.UserAgent = typeof(TileImageLoader).ToString();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream responseStream = response.GetResponseStream())
using (var response = (HttpWebResponse)request.GetResponse())
using (var responseStream = response.GetResponseStream())
{
var length = response.ContentLength;
var creationTime = DateTime.UtcNow.ToBinary();

View file

@ -129,9 +129,6 @@
<Compile Include="..\MapGraticule.Silverlight.WinRT.cs">
<Link>MapGraticule.Silverlight.WinRT.cs</Link>
</Compile>
<Compile Include="..\MapItem.cs">
<Link>MapItem.cs</Link>
</Compile>
<Compile Include="..\MapItem.Silverlight.WinRT.cs">
<Link>MapItem.Silverlight.WinRT.cs</Link>
</Compile>
@ -168,9 +165,6 @@
<Compile Include="..\MercatorTransform.cs">
<Link>MercatorTransform.cs</Link>
</Compile>
<Compile Include="..\Pushpin.cs">
<Link>Pushpin.cs</Link>
</Compile>
<Compile Include="..\Pushpin.Silverlight.WinRT.cs">
<Link>Pushpin.Silverlight.WinRT.cs</Link>
</Compile>