Pan With Middle Mouse?

1857
0
08-10-2013 06:49 AM
Labels (1)
RyanCoodey
Occasional Contributor III
We would like to implement middle mouse click and drag functionality like in ArcMap... so when using other tools that handle left clicks there is still a way to pan without switching back to a specific pan tool.

I found a few similar posts but none asking exactly what we are after??? so before we start rolling our own code for this, just wanted to ask a few questions:
1) The map control has no out of the box way to enable this, right?
2) Is there any way to bind middle mouse click and drags to this existing functionality on left mouse?
3) Is the source code for this functionality out there anywhere?

I had just started to write code for this, which does not work and as expected pans in the wrong directions for now:
        void Map_MouseMove(Object sender, MouseEventArgs e)
        {
            if (e.MiddleButton == MouseButtonState.Pressed)
            {
                Map map = sender as Map;
                map.PanTo(map.ScreenToMap(e.GetPosition(map)));
            }
        }

But after writing this little snippet thought maybe best I ask if there is a better way first???

Thanks so much for any information.
0 Kudos
0 Replies