ZoomEvent / MouseWheel

Within this forum we want to offer discussions all around our .NET based Map control including all .Net-language specific questions concerning calls of the xServer-API. Attention: xServer-relevant concepts can be found in further forums such as xRoute or xTour.
Post Reply
peter.detzner
Posts: 12
Joined: Fri Feb 10, 2017 6:57 am

ZoomEvent / MouseWheel

Post by peter.detzner »

I'd like to catch the "MouseWheel"-Scroll Event, thats how I defined it:

Code: Select all

<Map:WpfMap Name="ptvWpfMap" HorizontalAlignment="Stretch" Margin="0,0,0,0"  VerticalAlignment="Stretch" Loaded="ptvWpfMap_Loaded" ContextMenu="{StaticResource cmButton}" MouseWheel="ptvWpfMap_MouseWheel"/>
and the Code inside the class looks like this:

Code: Select all

   private void ptvWpfMap_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
{
    WriteLine("scroll");
}
What did I miss? Thanks for your help!
User avatar
Oliver Heilig
Posts: 154
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: ZoomEvent / MouseWheel

Post by Oliver Heilig »

Hello Peter,

do you want to modify the behavious of the mouse-wheel, or just get a notification when the user interacts on the map? To get the map-navagaion-events, you can catch the ViewPortBegin/While/EndChanged-Events.

ViewportBeginChanged="Map_ViewportBeginChanged"

These will be fired on all zoom and pan actions. You also can completely modify the behaviour of the Pan/Zoom class. There's a sample "CustomPanAndZoom" here https://github.com/ptv-logistics/xservernet-bin
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
peter.detzner
Posts: 12
Joined: Fri Feb 10, 2017 6:57 am

Re: ZoomEvent / MouseWheel

Post by peter.detzner »

The idea is, if the user scrolls to a "country" view, to collapse some symbols... if the user zooms in for a closer look, to expand some symbols...
User avatar
Oliver Heilig
Posts: 154
Joined: Tue May 13, 2014 12:10 pm
Location: Karlsruhe, Germany
Contact:

Re: ZoomEvent / MouseWheel

Post by Oliver Heilig »

ok, in your case i would catch the ViewPortEndChanged-Event. Then you can get the zoom level of the map and expand your icons. With the MapViewPort-Events you can update your data depending on the map zoom and center.
Map Viewport Events
Map Viewport Events
There's also a "Clustering" Demo in the DemoCenter which works like this.
Oliver Heilig
Chief Developer Logistic Services
PTV GROUP - Germany

https://github.com/oliverheilig/
Post Reply