Page 1 of 1

ZoomEvent / MouseWheel

Posted: Mon Apr 03, 2017 7:47 am
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!

Re: ZoomEvent / MouseWheel

Posted: Mon Apr 03, 2017 9:38 am
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

Re: ZoomEvent / MouseWheel

Posted: Mon Apr 03, 2017 9:55 am
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...

Re: ZoomEvent / MouseWheel

Posted: Mon Apr 03, 2017 12:29 pm
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.