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 =
|
2025-06-10 15:25:17 +02:00
|
|
|
|
MapPanel.AutoCollapseProperty.AddOwner<MapItem>();
|
2024-05-27 16:35:02 +02:00
|
|
|
|
|
|
|
|
|
|
public static readonly StyledProperty<Location> LocationProperty =
|
2025-06-10 15:25:17 +02:00
|
|
|
|
MapPanel.LocationProperty.AddOwner<MapItem>();
|
|
|
|
|
|
|
|
|
|
|
|
static MapItem()
|
|
|
|
|
|
{
|
|
|
|
|
|
LocationProperty.Changed.AddClassHandler<MapItem, Location>((item, e) => item.UpdateMapTransform());
|
|
|
|
|
|
}
|
2024-05-27 16:35:02 +02:00
|
|
|
|
|
|
|
|
|
|
protected override void OnPointerPressed(PointerPressedEventArgs e)
|
|
|
|
|
|
{
|
2025-03-19 17:16:22 +01:00
|
|
|
|
if (e.Pointer.Type != PointerType.Mouse &&
|
|
|
|
|
|
ItemsControl.ItemsControlFromItemContainer(this) is MapItemsControl mapItemsControl)
|
2025-03-12 19:45:08 +01:00
|
|
|
|
{
|
2025-03-19 17:16:22 +01:00
|
|
|
|
mapItemsControl.UpdateSelection(this, e);
|
2025-03-13 19:34:07 +01:00
|
|
|
|
}
|
2025-03-19 11:14:13 +01:00
|
|
|
|
|
|
|
|
|
|
e.Handled = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnPointerReleased(PointerReleasedEventArgs e)
|
|
|
|
|
|
{
|
2025-03-19 17:16:22 +01:00
|
|
|
|
if (e.Pointer.Type == PointerType.Mouse &&
|
|
|
|
|
|
e.InitialPressMouseButton == MouseButton.Left &&
|
|
|
|
|
|
ItemsControl.ItemsControlFromItemContainer(this) is MapItemsControl mapItemsControl)
|
2025-03-13 19:34:07 +01:00
|
|
|
|
{
|
2025-03-19 17:16:22 +01:00
|
|
|
|
mapItemsControl.UpdateSelection(this, e);
|
2025-03-12 19:45:08 +01:00
|
|
|
|
}
|
2025-03-19 17:16:22 +01:00
|
|
|
|
|
|
|
|
|
|
e.Handled = true;
|
2024-05-27 16:35:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|