Map move events do not work with MapItemsControl
See original GitHub issueWhen you add a container of elements to a map, such as a MapItemsControl, moving around the map does not work when you click on a child of MapItemsControl. Code example:
<m:Map>
<m:MapItemsControl>
<m:MapPolygon Fill="Blue" Stroke="Green" StrokeThickness="5"
Locations="47.6424,-122.3219 47.8424,-122.1747 47.5814,-122.1747"
Opacity="0.7">
<m:MapPolygon.Style>
<Style TargetType="m:MapPolygon">
<EventSetter Event="PreviewMouseRightButtonDown" Handler="PolygonMouseRightButtonDown" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand" />
</Trigger>
</Style.Triggers>
</Style>
</m:MapPolygon.Style>
</m:MapPolygon>
</m:MapItemsControl>
</m:Map>
Demonstration:
If we remove the container, then the movement will be processed correctly. This is just an example, since we are losing Binding to ItemsSource. Code example:
<m:Map>
<m:MapPolygon Fill="Blue" Stroke="Green" StrokeThickness="5"
Locations="47.6424,-122.3219 47.8424,-122.1747 47.5814,-122.1747"
Opacity="0.7">
<m:MapPolygon.Style>
<Style TargetType="m:MapPolygon">
<EventSetter Event="PreviewMouseRightButtonDown" Handler="PolygonMouseRightButtonDown" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand" />
</Trigger>
</Style.Triggers>
</Style>
</m:MapPolygon.Style>
</m:MapPolygon>
</m:Map>
Demonstration:
If we look, for example, at the Bing Maps Control, then the event of movement will be correctly processed by the children of MapItemsControl. Code example for bing maps:
<m:Map
CredentialsProvider="BING_MAPS_KEY">
<m:MapItemsControl>
<m:MapPolygon Fill="Blue" Stroke="Green" StrokeThickness="5"
Locations="47.6424,-122.3219 47.8424,-122.1747 47.5814,-122.1747"
Opacity="0.7">
<m:MapPolygon.Style>
<Style TargetType="m:MapPolygon">
<EventSetter Event="PreviewMouseRightButtonDown" Handler="PolygonMouseRightButtonDown" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand" />
</Trigger>
</Style.Triggers>
</Style>
</m:MapPolygon.Style>
</m:MapPolygon>
</m:MapItemsControl>
</m:Map>
Demonstration:
Is it possible to somehow get the behavior as in the last example?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
MapsItemControl and ObservableCollection behaviour
When I change the ObservableCollection, like the isVisible value (to show or to hide by the choices in the filter, the items didn't...
Read more >Is there a On Map Move event in OpenLayers?
If the automatic Geolocation is enabled, the event is called either the map moved automatically or the user moved it. So, this is...
Read more >azure-maps events not being added correctly in some ...
I have attempted adding events to map layers in various parts of my project, some work correctly and some don't, using the exact...
Read more >Windows 10, UWP and Experimenting with Inking onto a ...
It might be possible to capture all the pointer events on the InkCanvas and then somehow manually 'pass them on' to the underlying...
Read more >Event to notify when map has moved positioned with...
I am using the ArgGIS Javascript API v3.5. I have a map displayed in my browser, but it does not take up the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, it’s a simple change. Set
in line 26 in MapItemsControl.WPF.cs. Or derive from MapItemsControl and override OnMouseLeftButtonDown.
I’ll see if I can make this change in the library.
Ok, thank you. It works.