XAML-Map-Control/MapControl/UWP/MapItemsControl.UWP.cs
2021-01-13 21:19:27 +01:00

37 lines
1.4 KiB
C#

// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2021 Clemens Fischer
// Licensed under the Microsoft Public License (Ms-PL)
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
namespace MapControl
{
public partial class MapItem
{
public static readonly DependencyProperty AutoCollapseProperty = DependencyProperty.Register(
nameof(AutoCollapse), typeof(bool), typeof(MapItem),
new PropertyMetadata(false, (o, e) => MapPanel.SetAutoCollapse((FrameworkElement)o, (bool)e.NewValue)));
public static readonly DependencyProperty LocationProperty = DependencyProperty.Register(
nameof(Location), typeof(Location), typeof(MapItem),
new PropertyMetadata(null, (o, e) => MapPanel.SetLocation((FrameworkElement)o, (Location)e.NewValue)));
protected override void OnPointerPressed(PointerRoutedEventArgs e)
{
(ItemsControl.ItemsControlFromItemContainer(this) as MapItemsControl)?.OnItemClicked(
this, e.KeyModifiers.HasFlag(VirtualKeyModifiers.Control), e.KeyModifiers.HasFlag(VirtualKeyModifiers.Shift));
}
}
public partial class MapItemsControl
{
public new FrameworkElement ContainerFromItem(object item)
{
return (FrameworkElement)base.ContainerFromItem(item);
}
}
}