-1

Following This Sample I am hoping to be able a real MVVM pattern from the tutorial but based on my understanding the application is missing the Model and View classes!

I have the MapViewModel.cs like this

 public class MapViewModel
    {
        public MapViewModel(){ }

        private Map _map = new Map(Basemap.CreateStreets());
        public Map Map
        {
            get { return _map; }
            set { _map = value;  }
        }

    }

and the MainWindow.xaml

<Window.Resources>
    <local:MapViewModel x:Key="MapViewModel" />
</Window.Resources>
<Grid>
    <esri:MapView Map="{Binding Map, Source={StaticResource MapViewModel}}" />
</Grid>

but whre are the "MapView and "MapModel classes? Can you please help me to extracts and create those classes from the MapViewModel and create a real MVVM model?

Mona Coder
  • 6,212
  • 18
  • 66
  • 128
  • esri:MapView and Map are thrid party classes, you need to find and reference their dll in your project. – ASh Apr 30 '18 at 18:05
  • The model is provided by ArcGIS itself. You realise this is not free software? You have a licence for ArgGIS? – Andy Apr 30 '18 at 18:46

1 Answers1

0

There are 3 layers in MVVM pattern:

  • model

  • view

  • viemodel

That class you pasted belongs to viewmodel layer. It has properties which should be bound to your view (xaml). The viewmodel represents state of the view.

Now, to the view layer belongs your xaml file. You set all the controls, windows and all bindings in there.

And the model layer should have all the logic and data providers for you viewmodel class, the example could be your BaseMap class.

Jacek
  • 829
  • 12
  • 31
  • Hi Jacek, thanks for comment but I only understand your first line of the comment. :-) Can you please re-explain the second paragraph? – Mona Coder Apr 30 '18 at 17:21