mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 06:26:41 +00:00
Added MapItem.Location and LocationMemberPath
This commit is contained in:
parent
22fc5085de
commit
0d7387059b
11 changed files with 59 additions and 68 deletions
|
|
@ -7,13 +7,45 @@ using System;
|
|||
using Windows.Foundation;
|
||||
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 LocationMemberPathProperty = DependencyProperty.Register(
|
||||
nameof(LocationMemberPath), typeof(string), typeof(MapItem),
|
||||
new PropertyMetadata(null, (o, e) => BindingOperations.SetBinding(
|
||||
o, LocationProperty, new Binding { Path = new PropertyPath((string)e.NewValue) })));
|
||||
|
||||
public MapItem()
|
||||
{
|
||||
DefaultStyleKey = typeof(MapItem);
|
||||
|
||||
MapPanel.InitMapElement(this);
|
||||
}
|
||||
|
||||
public Location Location
|
||||
{
|
||||
get { return (Location)GetValue(LocationProperty); }
|
||||
set { SetValue(LocationProperty, value); }
|
||||
}
|
||||
|
||||
public string LocationMemberPath
|
||||
{
|
||||
get { return (string)GetValue(LocationMemberPathProperty); }
|
||||
set { SetValue(LocationMemberPathProperty, value); }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Manages a collection of selectable items on a Map.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ namespace MapControl
|
|||
}
|
||||
}
|
||||
|
||||
#region Method used only by derived classes MapPolyline, MapPolygon and MapMultiPolygon
|
||||
#region Methods used only by derived classes MapPolyline, MapPolygon and MapMultiPolygon
|
||||
|
||||
protected double GetLongitudeOffset(Location location)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,18 +3,28 @@
|
|||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
#if WINDOWS_UWP
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
#else
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
#endif
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Pushpin at a geographic location specified by the MapPanel.Location attached property.
|
||||
/// Pushpin at a geographic location specified by the Location property.
|
||||
/// </summary>
|
||||
public class Pushpin : ContentControl
|
||||
{
|
||||
public static readonly DependencyProperty LocationProperty =
|
||||
#if WINDOWS_UWP
|
||||
DependencyProperty.Register(
|
||||
nameof(Location), typeof(Location), typeof(Pushpin),
|
||||
new PropertyMetadata(null, (o, e) => MapPanel.SetLocation((FrameworkElement)o, (Location)e.NewValue)));
|
||||
#else
|
||||
MapPanel.LocationProperty.AddOwner(typeof(Pushpin));
|
||||
#endif
|
||||
public Pushpin()
|
||||
{
|
||||
DefaultStyleKey = typeof(Pushpin);
|
||||
|
|
@ -24,8 +34,8 @@ namespace MapControl
|
|||
|
||||
public Location Location
|
||||
{
|
||||
get { return MapPanel.GetLocation(this); }
|
||||
set { MapPanel.SetLocation(this, value); }
|
||||
get { return (Location)GetValue(LocationProperty); }
|
||||
set { SetValue(LocationProperty, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue