mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2026-04-06 06:55:04 +00:00
Map and MapItem input handling
This commit is contained in:
parent
9da6a13950
commit
74d3a4adfe
8 changed files with 241 additions and 104 deletions
|
|
@ -18,17 +18,57 @@ namespace MapControl
|
|||
DefaultStyleKeyProperty.OverrideMetadata(typeof(MapItem), new FrameworkPropertyMetadata(typeof(MapItem)));
|
||||
}
|
||||
|
||||
protected override void OnTouchDown(TouchEventArgs e)
|
||||
{
|
||||
// Prevent default touch handling.
|
||||
//
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnTouchUp(TouchEventArgs e)
|
||||
{
|
||||
// Prevent default touch handling.
|
||||
//
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
|
||||
{
|
||||
if (Keyboard.Modifiers.HasFlag(ModifierKeys.Shift))
|
||||
// Prevent default item selection on mouse down.
|
||||
//
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
|
||||
{
|
||||
// Prevent default item selection on mouse down.
|
||||
//
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
|
||||
{
|
||||
if (ItemsControl.ItemsControlFromItemContainer(this) is MapItemsControl mapItemsControl)
|
||||
{
|
||||
e.Handled = true;
|
||||
MapItemsControl.SelectItemsInRange(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnMouseLeftButtonDown(e);
|
||||
if (mapItemsControl.SelectionMode == SelectionMode.Extended &&
|
||||
Keyboard.Modifiers.HasFlag(ModifierKeys.Shift))
|
||||
{
|
||||
mapItemsControl.SelectItemsInRange(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Perform default mouse down item selection on mouse up.
|
||||
//
|
||||
base.OnMouseLeftButtonDown(e);
|
||||
}
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
protected override void OnMouseRightButtonUp(MouseButtonEventArgs e)
|
||||
{
|
||||
OnMouseLeftButtonUp(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue