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

36 lines
1.3 KiB
C#
Raw Normal View History

2025-02-27 18:46:32 +01:00
namespace MapControl
2024-05-27 16:35:02 +02:00
{
public partial class MapItem
{
public static readonly StyledProperty<bool> AutoCollapseProperty =
DependencyPropertyHelper.AddOwner<MapItem, bool>(MapPanel.AutoCollapseProperty);
public static readonly StyledProperty<Location> LocationProperty =
DependencyPropertyHelper.AddOwner<MapItem, Location>(MapPanel.LocationProperty, null,
2025-06-07 15:08:36 +02:00
(item, oldValue, newValue) => item.UpdateMapTransform());
2024-05-27 16:35:02 +02:00
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
}
}
}