I’m trying to copy some code I found from the Desktop version of ThinkGeo that uses a custom ExtentInteractiveOverlay to allow you to control track zooming and panning as seperate map modes. In other words I need a tool that does just track zoom and another tool that only pans. They cannot do both, which is the default behavior. The problem is that the WPF version doesn’t have a PanAndTrackZoomState property on ExtentInteractiveOverlay like the Desktop edition has. I think this is what allows you to tell the map that the shift key is down so all the user has to do is drag a rectangle. Is there an equivalent property on the WPF side because I haven’t been able to find one that works? Thanks in advance,
Chad
Custom ExtentInteractiveOverlay
Hi Chad,
Thanks for your post, May I make a confirmation with you? do you want to seperate the pan function and zoom function when you use track zoom? if yes, attached sample is for your reference, and here is a test video on our end for your information:screencast.com/t/6jlJWNXXezUg
If I missunderstood your requirement please feel free to correct me.
Best Regards
Summer;
Hi Summer,
That is exactly what I’m looking to do. One thing though, I couldn’t get the code file to display. It just opened an empty web page. Anything special I need to do? Thanks,
Chad
Hi Chad,
Sorry the attached file is missing, Please try the below codes for your need:
Just For Pan:
if (wpfMap1.ExtentOverlay.PanMode == MapPanMode.Disabled)
{
wpfMap1.ExtentOverlay.PanMode = MapPanMode.Default;
}
if (wpfMap1.ExtentOverlay.LeftClickDragMode == MapLeftClickDragMode.Default)
{
wpfMap1.ExtentOverlay.LeftClickDragMode = MapLeftClickDragMode.Disabled;
}
Just For TrackZoom
if (wpfMap1.ExtentOverlay.PanMode != MapPanMode.Disabled)
{
wpfMap1.ExtentOverlay.PanMode = MapPanMode.Disabled;
}
if (wpfMap1.ExtentOverlay.RightClickDragMode == MapRightClickDragMode.Disabled)
{
wpfMap1.ExtentOverlay.RightClickDragMode = MapRightClickDragMode.Default;
}
Let us know if there is any questions.
Thanks,
Johnny
Hi Chad,
Sorry the attached file is missing. Please try the below codes:
Just For Pan:
if (wpfMap1.ExtentOverlay.PanMode == MapPanMode.Disabled)
{
wpfMap1.ExtentOverlay.PanMode = MapPanMode.Default;
}
if (wpfMap1.ExtentOverlay.LeftClickDragMode == MapLeftClickDragMode.Default)
{
wpfMap1.ExtentOverlay.LeftClickDragMode = MapLeftClickDragMode.Disabled;
}
Just For TrackZoom:
if (wpfMap1.ExtentOverlay.PanMode != MapPanMode.Disabled)
{
wpfMap1.ExtentOverlay.PanMode = MapPanMode.Disabled;
}
if (wpfMap1.ExtentOverlay.RightClickDragMode == MapRightClickDragMode.Disabled)
{
wpfMap1.ExtentOverlay.RightClickDragMode = MapRightClickDragMode.Default;
}
Any questions, don’t hesitate to let us know.
Thanks,
Johnny
Hi Chad,
Sorry the attached file is missing. Please following the below codes:
Disable Pan:
if (wpfMap1.ExtentOverlay.PanMode != MapPanMode.Disabled)
{
wpfMap1.ExtentOverlay.PanMode = MapPanMode.Disabled;
}
if (wpfMap1.ExtentOverlay.LeftClickDragMode == MapLeftClickDragMode.Disabled)
{
wpfMap1.ExtentOverlay.LeftClickDragMode = MapLeftClickDragMode.Default;
}
Disable TrackZoom:
if (wpfMap1.ExtentOverlay.PanMode == MapPanMode.Disabled)
{
wpfMap1.ExtentOverlay.PanMode = MapPanMode.Default;
}
if (wpfMap1.ExtentOverlay.LeftClickDragMode == MapLeftClickDragMode.Default)
{
wpfMap1.ExtentOverlay.LeftClickDragMode = MapLeftClickDragMode.Disabled;
}
If any questions, don’t hesitate to let us know.
Thanks,
Johnny
Thanks Johnny. I got it to work with this code. The next thing I would like to do if possible is cancel a track zoom after the track zoom starts by clicking the Escape key. In other words after the user starts a zoom box, but before they release the mouse button that finishes the track zoom I would like to give them the option to cancel the track zoom. I tried doing it with a custom class that inherits from ExtentInteractiveOverlay and then overriding the various keydown functions (KeyDownCore and OnMapKeyDown), but those aren’t firing for me. Thanks,
Chad
Hi Chad,
There is no need to override the ExtentInteractiveOverlay as the Wpf Edition have supported the Escape key to cancel the current TrackZoom operation. Please make the map control focus after enable the trackzoom like the below codes:
if (wpfMap1.ExtentOverlay.PanMode != MapPanMode.Disabled)
{
wpfMap1.ExtentOverlay.PanMode = MapPanMode.Disabled;
}
if (wpfMap1.ExtentOverlay.LeftClickDragMode == MapLeftClickDragMode.Disabled)
{
wpfMap1.ExtentOverlay.LeftClickDragMode = MapLeftClickDragMode.Default;
}
wpfMap1.Focus();
Also, the various keydown functions you are trying to override do not be fired is because map is not the current focused control.
Any questions, please feel free to let us know.
Thank,
Johnny
Hi Johnny,
Giving the map focus fixed my issue. I added a couple of lines as well so the user doesn't have to hold a key down when track zooming and the user can pan freely when in Pan mode like below.
Chad
Select
Case
strButtonName
Case
zoomInButton.Name
WpfMap1.ExtentOverlay.PanMode = MapPanMode.Disabled
WpfMap1.ExtentOverlay.LeftClickDragMode = MapLeftClickDragMode.
Default
WpfMap1.ExtentOverlay.LeftClickDragKey = Forms.Keys.None
Case
panButton.Name
WpfMap1.ExtentOverlay.PanMode = MapPanMode.StandardPanning
WpfMap1.ExtentOverlay.LeftClickDragMode = MapLeftClickDragMode.Disabled
WpfMap1.ExtentOverlay.LeftClickDragKey = Forms.Keys.EraseEof
' Set to obscure key
End
Select
WpfMap1.Focus()
Hi Chad,
That looks better. Good to hear it works.
If more questions, please feel free to let us know.
Thanks,
Johnny