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

37 lines
1.4 KiB
C#
Raw Normal View History

2018-11-13 21:35:48 +01:00
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
2021-01-13 21:19:27 +01:00
// © 2021 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
{
2021-01-13 00:08:55 +01:00
public static readonly DependencyProperty AutoCollapseProperty = DependencyProperty.Register(
nameof(AutoCollapse), typeof(bool), typeof(MapItem),
2021-01-16 18:32:31 +01:00
new PropertyMetadata(false, (o, e) => MapPanel.SetAutoCollapse((MapItem)o, (bool)e.NewValue)));
2021-01-13 00:08:55 +01:00
public static readonly DependencyProperty LocationProperty = DependencyProperty.Register(
nameof(Location), typeof(Location), typeof(MapItem),
2021-01-16 18:32:31 +01:00
new PropertyMetadata(null, (o, e) => MapPanel.SetLocation((MapItem)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
}
}
}