mirror of
https://github.com/ClemensFischer/XAML-Map-Control.git
synced 2025-12-06 07:12:04 +01:00
Sample Applications DoubleTapped
This commit is contained in:
parent
45b6c012e0
commit
49bd02863a
|
|
@ -64,8 +64,7 @@
|
|||
<map:MapItemsControl ItemsSource="{Binding Pushpins}"
|
||||
SelectedItem="{Binding SelectedPushpin}"
|
||||
SelectionMode="Multiple"
|
||||
SelectionChanged="MapItemsControlSelectionChanged"
|
||||
DoubleTapped="MapItemsControlDoubleTapped">
|
||||
SelectionChanged="MapItemsControlSelectionChanged">
|
||||
<map:MapItemsControl.Styles>
|
||||
<Style Selector="map|MapItem">
|
||||
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>
|
||||
|
|
|
|||
|
|
@ -36,14 +36,12 @@ namespace SampleApplication
|
|||
map.TargetHeading = 0d;
|
||||
}
|
||||
|
||||
private void MapItemsControlDoubleTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
e.Handled = true; // prevent MapDoubleTapped
|
||||
}
|
||||
|
||||
private void MapDoubleTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
map.TargetCenter = map.ViewToLocation(e.GetPosition(map));
|
||||
if (e.Source == map)
|
||||
{
|
||||
map.TargetCenter = map.ViewToLocation(e.GetPosition(map));
|
||||
}
|
||||
}
|
||||
|
||||
private void MapPointerPressed(object sender, PointerPressedEventArgs e)
|
||||
|
|
@ -52,11 +50,7 @@ namespace SampleApplication
|
|||
{
|
||||
var point = e.GetCurrentPoint(map);
|
||||
|
||||
if (point.Properties.IsLeftButtonPressed)
|
||||
{
|
||||
map.Cursor = new Cursor(StandardCursorType.Hand);
|
||||
}
|
||||
else if (point.Properties.IsRightButtonPressed)
|
||||
if (point.Properties.IsRightButtonPressed)
|
||||
{
|
||||
e.Pointer.Capture(map);
|
||||
var location = map.ViewToLocation(point.Position);
|
||||
|
|
@ -76,11 +70,10 @@ namespace SampleApplication
|
|||
if (e.Pointer.Captured == map)
|
||||
{
|
||||
e.Pointer.Capture(null);
|
||||
map.Cursor = null;
|
||||
measurementLine.IsVisible = false;
|
||||
measurementLine.Locations = null;
|
||||
}
|
||||
|
||||
map.Cursor = null;
|
||||
}
|
||||
|
||||
private void MapPointerMoved(object sender, PointerEventArgs e)
|
||||
|
|
|
|||
|
|
@ -163,16 +163,14 @@
|
|||
<map:MapItemsControl ItemContainerStyle="{StaticResource PointItemStyle}"
|
||||
ItemsSource="{Binding Points}"
|
||||
SelectionMode="Multiple"
|
||||
LocationMemberPath="Location"
|
||||
DoubleTapped="MapItemsControlDoubleTapped"/>
|
||||
LocationMemberPath="Location"/>
|
||||
|
||||
<map:MapItemsControl ItemContainerStyle="{StaticResource PushpinItemStyle}"
|
||||
ItemsSource="{Binding Pushpins}"
|
||||
SelectedItem="{Binding SelectedPushpin, Mode=TwoWay}"
|
||||
SelectionMode="Multiple"
|
||||
LocationMemberPath="Location"
|
||||
SelectionChanged="MapItemsControlSelectionChanged"
|
||||
DoubleTapped="MapItemsControlDoubleTapped"/>
|
||||
SelectionChanged="MapItemsControlSelectionChanged"/>
|
||||
|
||||
<map:MapPath Location="53.5,8.2" Stroke="Blue" StrokeThickness="3" Fill="#1F007F00" IsHitTestVisible="False">
|
||||
<map:MapPath.Data>
|
||||
|
|
|
|||
|
|
@ -36,14 +36,12 @@ namespace SampleApplication
|
|||
Debug.WriteLine("SelectedItems: " + string.Join(", ", ((MapItemsControl)sender).SelectedItems.OfType<PointItem>().Select(item => item.Name)));
|
||||
}
|
||||
|
||||
private void MapItemsControlDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
|
||||
{
|
||||
e.Handled = true; // prevent MapDoubleTapped
|
||||
}
|
||||
|
||||
private void MapDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
|
||||
{
|
||||
map.TargetCenter = map.ViewToLocation(e.GetPosition(map));
|
||||
if (e.OriginalSource is Map map)
|
||||
{
|
||||
map.TargetCenter = map.ViewToLocation(e.GetPosition(map));
|
||||
}
|
||||
}
|
||||
|
||||
private void ResetHeadingButtonClick(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
Loading…
Reference in a new issue