mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-05 14:37:01 +00:00
ParentMap property initialization
This commit is contained in:
parent
6a9b622793
commit
207565feba
12 changed files with 86 additions and 47 deletions
|
|
@ -131,9 +131,6 @@
|
|||
<Compile Include="..\Shared\OrthographicProjection.cs">
|
||||
<Link>OrthographicProjection.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\Pushpin.cs">
|
||||
<Link>Pushpin.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Shared\StereographicProjection.cs">
|
||||
<Link>StereographicProjection.cs</Link>
|
||||
</Compile>
|
||||
|
|
@ -198,6 +195,7 @@
|
|||
<Compile Include="Matrix.UWP.cs" />
|
||||
<Compile Include="Point.UWP.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Pushpin.cs" />
|
||||
<Compile Include="Tile.UWP.cs" />
|
||||
<Compile Include="TileImageLoader.UWP.cs" />
|
||||
<Compile Include="ImageLoader.UWP.cs" />
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@ namespace MapControl
|
|||
nameof(Location), typeof(Location), typeof(MapItem),
|
||||
new PropertyMetadata(null, (o, e) => MapPanel.SetLocation((MapItem)o, (Location)e.NewValue)));
|
||||
|
||||
public MapItem()
|
||||
{
|
||||
DefaultStyleKey = typeof(MapItem);
|
||||
MapPanel.InitMapElement(this);
|
||||
}
|
||||
|
||||
protected override void OnPointerPressed(PointerRoutedEventArgs e)
|
||||
{
|
||||
(ItemsControl.ItemsControlFromItemContainer(this) as MapItemsControl)?.OnItemClicked(
|
||||
|
|
@ -28,6 +34,12 @@ namespace MapControl
|
|||
|
||||
public partial class MapItemsControl
|
||||
{
|
||||
public MapItemsControl()
|
||||
{
|
||||
DefaultStyleKey = typeof(MapItemsControl);
|
||||
MapPanel.InitMapElement(this);
|
||||
}
|
||||
|
||||
public new FrameworkElement ContainerFromItem(object item)
|
||||
{
|
||||
return (FrameworkElement)base.ContainerFromItem(item);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ namespace MapControl
|
|||
private static readonly DependencyProperty ViewPositionProperty = DependencyProperty.RegisterAttached(
|
||||
"ViewPosition", typeof(Point?), typeof(MapPanel), new PropertyMetadata(null));
|
||||
|
||||
public MapPanel()
|
||||
{
|
||||
InitMapElement(this);
|
||||
}
|
||||
|
||||
public static void InitMapElement(FrameworkElement element)
|
||||
{
|
||||
if (element is MapBase)
|
||||
|
|
@ -31,7 +36,7 @@ namespace MapControl
|
|||
}
|
||||
else
|
||||
{
|
||||
// Workaround for missing property value inheritance in Windows Runtime.
|
||||
// Workaround for missing property value inheritance in UWP.
|
||||
// Loaded and Unloaded handlers set and clear the ParentMap property value.
|
||||
|
||||
element.Loaded += (s, e) => GetParentMap(element);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ namespace MapControl
|
|||
{
|
||||
public partial class MapPath : Path
|
||||
{
|
||||
public MapPath()
|
||||
{
|
||||
MapPanel.InitMapElement(this);
|
||||
}
|
||||
|
||||
#region Methods used only by derived classes MapPolyline and MapPolygon
|
||||
|
||||
protected void DataCollectionPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||
|
|
|
|||
47
MapControl/UWP/Pushpin.cs
Normal file
47
MapControl/UWP/Pushpin.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
||||
// © 2021 Clemens Fischer
|
||||
// Licensed under the Microsoft Public License (Ms-PL)
|
||||
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace MapControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Pushpin at a geographic location specified by the Location property.
|
||||
/// </summary>
|
||||
public class Pushpin : ContentControl
|
||||
{
|
||||
public static readonly DependencyProperty AutoCollapseProperty = DependencyProperty.Register(
|
||||
nameof(AutoCollapse), typeof(bool), typeof(Pushpin),
|
||||
new PropertyMetadata(false, (o, e) => MapPanel.SetAutoCollapse((Pushpin)o, (bool)e.NewValue)));
|
||||
|
||||
public static readonly DependencyProperty LocationProperty = DependencyProperty.Register(
|
||||
nameof(Location), typeof(Location), typeof(Pushpin),
|
||||
new PropertyMetadata(null, (o, e) => MapPanel.SetLocation((Pushpin)o, (Location)e.NewValue)));
|
||||
|
||||
public Pushpin()
|
||||
{
|
||||
DefaultStyleKey = typeof(Pushpin);
|
||||
MapPanel.InitMapElement(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets MapPanel.AutoCollapse.
|
||||
/// </summary>
|
||||
public bool AutoCollapse
|
||||
{
|
||||
get { return (bool)GetValue(AutoCollapseProperty); }
|
||||
set { SetValue(AutoCollapseProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets/sets MapPanel.Location.
|
||||
/// </summary>
|
||||
public Location Location
|
||||
{
|
||||
get { return (Location)GetValue(LocationProperty); }
|
||||
set { SetValue(LocationProperty, value); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue