Select to view content in your preferred language

Zoom Control

907
6
01-26-2011 11:04 AM
DanielSanders
Occasional Contributor
The ESRI Navigation control is very nice, but is there a way to hide the panning and full extent controls (e.g. all I want is a zoom control)?

If the answer is no, how would a simple Slider control be bound to a map control for zooming in and out?

Thank you...
0 Kudos
6 Replies
dotMorten_esri
Esri Notable Contributor
Yes there is. To do this, get your head around "Control Templating" for Silverlight.
Its easiest to do in Expression Blend. Open your project there, select the navigation control, right-click it and select craete a copy of the control template. Now you get access to the individual elements of the template, and can remove the buttons you don't want by simply selecting and deleting them.

I covered this at the DevSummit 2009, which is available here: http://resources.arcgis.com/gallery/video/arcgis-api-for-silverlightwpf/details?entryID=AD6EB60D-142...
Jump forward to roughly ~35min.
0 Kudos
DanielSanders
Occasional Contributor
I see. Is it possible to copy the control without Expression Blend?

Thanks for your help...
0 Kudos
dotMorten_esri
Esri Notable Contributor
I'm not sure. I have never tried it anywhere else 🙂

If you don't find another way to do it, you can download Blend as a 60 day free trial.
0 Kudos
DanielWalton
Frequent Contributor
You could just download the toolkit source code at codeplex and modify the XAML in Visual Studio. You would have to be careful to remove references to the pan and rotate elements in the code file too. But I agree with Morten, you're probably going to want to get Blend if you plan on doing much more customization.
0 Kudos
DanielSanders
Occasional Contributor
Thank you both for your help...
0 Kudos
dotMorten_esri
Esri Notable Contributor
You would have to be careful to remove references to the pan and rotate elements in the code file too.


Actually no. The control should be able to handle missing elements from the template just fine. You could delete everything from the template and it should still run (although of course nothing would be rendered :-)). So no need to modify the codebehind, or for that matter recompile the api. But you can extract the template from the source on codeplex.
You might also want to look at the two templates that comes installed with the API. They both override the default navigation template, so you can look at how that was done in there.
0 Kudos