namespace MapControl { public partial class MapItem { public static readonly StyledProperty AutoCollapseProperty = DependencyPropertyHelper.AddOwner(MapPanel.AutoCollapseProperty); public static readonly StyledProperty LocationProperty = DependencyPropertyHelper.AddOwner(MapPanel.LocationProperty, null, (item, oldValue, newValue) => item.UpdateMapTransform(newValue)); /// /// Replaces ListBoxItem pointer event handling by not calling base.OnPointerPressed. /// Setting e.Handled = true generates a PointerReleased event in the parent MapItemsControl, /// which resembles the behavior of the ListBox base class. /// protected override void OnPointerPressed(PointerPressedEventArgs e) { if (!e.Handled) { e.Handled = true; if (ItemsControl.ItemsControlFromItemContainer(this) is MapItemsControl mapItemsControl) { mapItemsControl.OnItemClicked(this, e.KeyModifiers.HasFlag(KeyModifiers.Control)); } } } } }