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

@ -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);