XAML-Map-Control/MapControl/UWP/MapItemsControl.UWP.cs

33 lines
1.1 KiB
C#
Raw Normal View History

2018-11-13 21:35:48 +01:00
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
// © 2020 Clemens Fischer
2018-11-13 21:35:48 +01:00
// Licensed under the Microsoft Public License (Ms-PL)
using Windows.System;
2018-11-14 17:53:37 +01:00
using Windows.UI.Xaml;
2018-11-13 21:35:48 +01:00
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Input;
namespace MapControl
{
public partial class MapItem
2018-11-13 21:35:48 +01:00
{
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)));
2018-11-13 21:35:48 +01:00
protected override void OnPointerPressed(PointerRoutedEventArgs e)
{
2018-11-14 17:53:37 +01:00
(ItemsControl.ItemsControlFromItemContainer(this) as MapItemsControl)?.OnItemClicked(
2018-11-13 21:35:48 +01:00
this, e.KeyModifiers.HasFlag(VirtualKeyModifiers.Control), e.KeyModifiers.HasFlag(VirtualKeyModifiers.Shift));
}
}
public partial class MapItemsControl
{
2018-11-14 17:53:37 +01:00
public new FrameworkElement ContainerFromItem(object item)
2018-11-13 21:35:48 +01:00
{
2018-11-14 17:53:37 +01:00
return (FrameworkElement)base.ContainerFromItem(item);
2018-11-13 21:35:48 +01:00
}
}
}