Sample applications DoubleTapped handling

This commit is contained in:
ClemensFischer 2024-05-31 09:17:44 +02:00
parent e8b6d318ec
commit 12a49f0881
4 changed files with 16 additions and 9 deletions

View file

@ -14,12 +14,12 @@
ZoomLevel="11" MinZoomLevel="3"
Center="53.5,8.2"
ManipulationModes="All"
DoubleTapped="OnMapDoubleTapped">
DoubleTapped="MapDoubleTapped">
<map:MapItemsControl ItemsSource="{Binding Pushpins}"
SelectedItem="{Binding SelectedPushpin}"
SelectionMode="Multiple"
DoubleTapped="OnMapItemsControlDoubleTapped">
DoubleTapped="MapItemsControlDoubleTapped">
<map:MapItemsControl.Styles>
<Style Selector="map|MapItem">
<Setter Property="map:MapPanel.Location" Value="{Binding Location}"/>

View file

@ -72,12 +72,12 @@ namespace SampleApplication
partial void AddTestLayers();
private void OnMapItemsControlDoubleTapped(object sender, TappedEventArgs e)
private void MapItemsControlDoubleTapped(object sender, TappedEventArgs e)
{
e.Handled = true; // prevent OnMapDoubleTapped
e.Handled = true; // prevent MapDoubleTapped
}
private void OnMapDoubleTapped(object sender, TappedEventArgs e)
private void MapDoubleTapped(object sender, TappedEventArgs e)
{
map.TargetCenter = map.ViewToLocation(e.GetPosition(map));
}

View file

@ -169,13 +169,15 @@
<map:MapItemsControl ItemContainerStyle="{StaticResource PointItemStyle}"
ItemsSource="{Binding Points}"
SelectionMode="Multiple"
LocationMemberPath="Location"/>
LocationMemberPath="Location"
DoubleTapped="MapItemsControlDoubleTapped"/>
<map:MapItemsControl ItemContainerStyle="{StaticResource PushpinItemStyle}"
ItemsSource="{Binding Pushpins}"
SelectedItem="{Binding SelectedPushpin, Mode=TwoWay}"
SelectionMode="Multiple"
LocationMemberPath="Location"/>
LocationMemberPath="Location"
DoubleTapped="MapItemsControlDoubleTapped"/>
<map:MapPath Location="53.5,8.2" Stroke="Blue" StrokeThickness="3" Fill="#1F007F00">
<map:MapPath.Data>

View file

@ -82,9 +82,9 @@ namespace SampleApplication
partial void AddTestLayers();
private void ResetHeadingButtonClick(object sender, RoutedEventArgs e)
private void MapItemsControlDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
map.TargetHeading = 0d;
e.Handled = true; // prevent MapDoubleTapped
}
private void MapDoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
@ -92,6 +92,11 @@ namespace SampleApplication
map.TargetCenter = map.ViewToLocation(e.GetPosition(map));
}
private void ResetHeadingButtonClick(object sender, RoutedEventArgs e)
{
map.TargetHeading = 0d;
}
private async void MapPointerPressed(object sender, PointerRoutedEventArgs e)
{
if (e.Pointer.PointerDeviceType == PointerDeviceType.Mouse)