2018-11-13 21:35:48 +01:00
|
|
|
|
// XAML Map Control - https://github.com/ClemensFischer/XAML-Map-Control
|
2019-03-27 18:39:59 +01:00
|
|
|
|
// © 2019 Clemens Fischer
|
2018-11-13 21:35:48 +01:00
|
|
|
|
// Licensed under the Microsoft Public License (Ms-PL)
|
|
|
|
|
|
|
2018-11-14 17:53:37 +01:00
|
|
|
|
using System.Windows;
|
2018-11-13 21:35:48 +01:00
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MapControl
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Container class for an item in a MapItemsControl.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class MapItem : ListBoxItem
|
|
|
|
|
|
{
|
|
|
|
|
|
public MapItem()
|
|
|
|
|
|
{
|
|
|
|
|
|
DefaultStyleKey = typeof(MapItem);
|
|
|
|
|
|
|
|
|
|
|
|
MapPanel.InitMapElement(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Handled = true;
|
|
|
|
|
|
|
2018-11-14 17:53:37 +01:00
|
|
|
|
(ItemsControl.ItemsControlFromItemContainer(this) as MapItemsControl)?.OnItemClicked(
|
2018-11-13 21:35:48 +01:00
|
|
|
|
this, Keyboard.Modifiers.HasFlag(ModifierKeys.Control), Keyboard.Modifiers.HasFlag(ModifierKeys.Shift));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public partial class MapItemsControl
|
|
|
|
|
|
{
|
2018-11-14 17:53:37 +01:00
|
|
|
|
public FrameworkElement ContainerFromItem(object item)
|
2018-11-13 21:35:48 +01:00
|
|
|
|
{
|
2018-11-14 17:53:37 +01:00
|
|
|
|
return (FrameworkElement)ItemContainerGenerator.ContainerFromItem(item);
|
2018-11-13 21:35:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2018-11-14 17:53:37 +01:00
|
|
|
|
public object ItemFromContainer(FrameworkElement container)
|
2018-11-13 21:35:48 +01:00
|
|
|
|
{
|
2018-11-14 17:53:37 +01:00
|
|
|
|
return ItemContainerGenerator.ItemFromContainer(container);
|
2018-11-13 21:35:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SelectItemsInGeometry(Geometry geometry)
|
|
|
|
|
|
{
|
|
|
|
|
|
SelectItemsByPosition(p => geometry.FillContains(p));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|