ParentMap property initialization

This commit is contained in:
ClemensF 2021-01-17 00:31:30 +01:00
parent 6a9b622793
commit 207565feba
12 changed files with 86 additions and 47 deletions

View file

@ -26,13 +26,6 @@ namespace MapControl
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);
}
/// <summary>
/// Gets/sets MapPanel.AutoCollapse.
/// </summary>
@ -66,13 +59,6 @@ namespace MapControl
/// </summary>
public partial class MapItemsControl : ListBox
{
public MapItemsControl()
{
DefaultStyleKey = typeof(MapItemsControl);
MapPanel.InitMapElement(this);
}
protected override DependencyObject GetContainerForItemOverride()
{
return new MapItem();

View file

@ -42,11 +42,6 @@ namespace MapControl
set { SetParentMap(value); }
}
public MapPanel()
{
InitMapElement(this);
}
/// <summary>
/// Gets a value that controls whether an element's Visibility is automatically
/// set to Collapsed when it is located outside the visible viewport area.

View file

@ -24,11 +24,6 @@ namespace MapControl
private MapBase parentMap;
public MapPath()
{
MapPanel.InitMapElement(this);
}
/// <summary>
/// Gets or sets a Location that is used as
/// - either the origin point of a geometry specified in cartesian map units (meters)

View file

@ -61,7 +61,9 @@ namespace MapControl
updateTimer = new DispatcherTimer { Interval = UpdateInterval };
updateTimer.Tick += (s, e) => Update(false);
#if WINDOWS_UWP
MapPanel.InitMapElement(this);
#endif
}
public ITileImageLoader TileImageLoader { get; }

View file

@ -1,58 +0,0 @@
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2021 Clemens Fischer
// 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 Location property.
/// </summary>
public class Pushpin : ContentControl
{
#if WINDOWS_UWP
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)));
#else
public static readonly DependencyProperty AutoCollapseProperty = MapPanel.AutoCollapseProperty.AddOwner(typeof(Pushpin));
public static readonly DependencyProperty LocationProperty = MapPanel.LocationProperty.AddOwner(typeof(Pushpin));
#endif
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); }
}
}
}