Im trying to implement fully MVVM pattern.

777
3
05-21-2018 05:56 AM
SlavaLoshkariev
New Contributor

Im trying to implement fully MVVM pattern with runtime SDK 100.2. The question is can i implements all the features of ESRI. Set basemap/surface/layers/graphics and so.......

0 Kudos
3 Replies
JoeHershman
MVP Regular Contributor

Yes...(and no?).  If you just need to get at the Map object this is very easy.  Just data bind the map from your VM and use in that way.  I believe that the MapView object itself contains too much functionality and needs a way to share across an application.  I believe this is possible while still using MVVM, others would disagree that the approach is MVVM.  Accessing MapView methods like IdentifyGraphicsOverlaysAsync from viewmodel.  But besides this very specific case, yes, the API is designed along these lines and you should be able to do what you need and use MVVM

0 Kudos
dotMorten_esri
Esri Frequent Contributor

The only current issue I'm aware of is assigning the LocationDisplay from a viewmodel to the MapView as it is not currently settable (it's on our backlog to resolve). Everything else fully supports MVVM.

Naturally view operations (like zoom to, click events etc) have to happen in your view code, but there's ways to have your VM trigger/raise events that the view will listen and react to, so you don't have to bleed your view into your viewmodel.

0 Kudos
MaraStoica4
Occasional Contributor

Take a look at the Maps App Example App. It implements MVVM in a cross platform environment.  GitHub - Esri/maps-app-dotnet: Your organization's suite of cross platform mapping apps built with t... 

0 Kudos