XAML-Map-Control/MapControl/Avalonia/MapItem.Avalonia.cs

32 lines
927 B
C#
Raw Normal View History

using Avalonia.Controls;
2025-08-19 19:43:02 +02:00
using Avalonia.Input;
namespace MapControl
2024-05-27 16:35:02 +02:00
{
public partial class MapItem
{
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
if (e.Pointer.Type != PointerType.Mouse &&
ItemsControl.ItemsControlFromItemContainer(this) is MapItemsControl mapItemsControl)
2025-03-12 19:45:08 +01:00
{
mapItemsControl.UpdateSelection(this, e);
}
2025-03-19 11:14:13 +01:00
e.Handled = true;
}
protected override void OnPointerReleased(PointerReleasedEventArgs e)
{
if (e.Pointer.Type == PointerType.Mouse &&
e.InitialPressMouseButton == MouseButton.Left &&
ItemsControl.ItemsControlFromItemContainer(this) is MapItemsControl mapItemsControl)
{
mapItemsControl.UpdateSelection(this, e);
2025-03-12 19:45:08 +01:00
}
e.Handled = true;
2024-05-27 16:35:02 +02:00
}
}
}