Open dotMorten opened 7 years ago
We also have something very similar here:
and:
Which together allow hooking into multiple view-models to update the viewpoint on a given GeoView:
<esri:MapView Map="{Binding Map, Source={StaticResource MapViewModel}}" >
<utils:GeoViewExtensions.ViewpointControllers>
<utils:ViewpointControllerCollection>
<utils:ViewpointController Viewpoint="{Binding AreaOfInterest, Source={StaticResource MapViewModel}}"/>
<utils:ViewpointController Viewpoint="{Binding AreaOfInterest, Source={StaticResource GeocodeViewModel}}"/>
<utils:ViewpointController Viewpoint="{Binding AreaOfInterest, Source={StaticResource RouteViewModel}}"/>
</utils:ViewpointControllerCollection>
</utils:GeoViewExtensions.ViewpointControllers>
</esri:MapView>
The nice thing here is that it allows for the area of interest updates to come from multiple sources.
Not to get too off-topic, but there seem to be lots of other cases where these sort of binding helpers are desirable as well. From the same app, here's a HoldingLocationController that allows listening to the GeoView's holding location from a view-model. Or we recently had a user ask about handling identify operations on GeoNet (here), and I was able to adapt and share IdentifyController class from an Example App that's currently under development. Seems like there's potential for a whole little area of Toolkit development here.
Something along the lines of this to support MVVM and setting extents, while keeping your view model and view decoupled:
https://github.com/Esri/arcgis-runtime-demos-dotnet/blob/master/src/TurnByTurn/RoutingSample.Shared/CommandBinder.cs#L26