XAML-Map-Control/MapControl/WPF/MapItem.WPF.cs
2025-03-13 19:34:07 +01:00

36 lines
1.1 KiB
C#

using System.Windows;
using System.Windows.Input;
namespace MapControl
{
public partial class MapItem
{
public static readonly DependencyProperty AutoCollapseProperty =
DependencyPropertyHelper.AddOwner<MapItem, bool>(MapPanel.AutoCollapseProperty);
public static readonly DependencyProperty LocationProperty =
DependencyPropertyHelper.AddOwner<MapItem, Location>(MapPanel.LocationProperty, null,
(item, oldValue, newValue) => item.UpdateMapTransform(newValue));
static MapItem()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(MapItem), new FrameworkPropertyMetadata(typeof(MapItem)));
}
/// <summary>
/// Prevent range selection by Shift+MouseLeftButtonDown.
/// </summary>
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
if (Keyboard.Modifiers.HasFlag(ModifierKeys.Shift))
{
e.Handled = true;
}
else
{
base.OnMouseLeftButtonDown(e);
}
}
}
}