Hi guys. Have another question. This one is about working with custom zoom controls to act on a Map control when everything is wired with MVVM. Running in SL4.Right now, I have my View which contains the Map control. The layers of the map control is bound to a property of the view model thatwill load up layers on start. Works great. I was also able to create a Navigation control in the View (in XAML) which is bound to the Map. That works as well.But what if I wanted to instead of using a Nav control create a set of images or buttons that control the zoom. Say Zoom Extent, in, out, etc. Can I wire the button directly to the Map control in XAML or does it have to pass back to the ViewModel through some kind of command binding?If it has to be through the viewmodel, how to do I wire that up? I read that the Map.Extent is not bindable. I also read that I can create the MapExtentHelper dependency to deal with this but didn't couldn't quite get my head around how to implement it.ThanksErnie
<esri:Map x:Name="MyMap" WrapAround="True" Extent="-15000000,2000000,-7000000,8000000" Layers="{Binding MapLayers}">
public interface IMapView { Map Map { get; } }
<Buttons:MyToggleButton Text="{Binding Path=LanguageResource.ButtonText, Source={StaticResource LocalizedStrings}}" IsChecked="{Binding ZoomInIsChecked, Mode=TwoWay}" Click="{Binding ZoomCommand}" CommandParameter="ZoomIn" GroupName="ZoomButtons"/>
[Import] public IMapView MapView {get;set;} private ICommand _zoomCommand; public ICommand ZoomCommand { get { return _zoomCommand?? (_zoomCommand= new DelegateCommand<string>(ExecuteZoomCommand)); } } private void ExecuteZoomCommand(string zoomType) { //Here would be my zoom logic }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.