mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-04 14:08:32 +00:00
MapItem mouse/pointer event handling
This commit is contained in:
parent
417d4c8987
commit
fc242ee7a4
3 changed files with 27 additions and 11 deletions
|
|
@ -9,10 +9,19 @@
|
|||
DependencyPropertyHelper.AddOwner<MapItem, Location>(MapPanel.LocationProperty, null,
|
||||
(item, oldValue, newValue) => item.UpdateMapTransform(newValue));
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
||||
{
|
||||
(ItemsControl.ItemsControlFromItemContainer(this) as MapItemsControl)?
|
||||
.OnItemClicked(this, e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
if (!e.Handled)
|
||||
{
|
||||
e.Handled = true;
|
||||
(ItemsControl.ItemsControlFromItemContainer(this) as MapItemsControl)?
|
||||
.OnItemClicked(this, e.KeyModifiers.HasFlag(KeyModifiers.Control));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue