Setting up an app to use the MVVM pattern is relatively straightforward, but can involve a lot of boiler plate code. Let's illustrate this so that you can see all of the steps and the way things work exactly:
Create a new ArcGIS Runtime app as you did in Chapter 1, Introduction to ArcGIS Runtime. Name your project
Chapter2
.Go ahead and copy the XAML and code-behind file from that project to this new project.
Create a new, standard C# class. Name the file
Model.cs
, as shown here:Add the following code to the
Model
class:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Chapter2 { public class Model { private string searchText = "Lancaster"; private string basemapLayerUri = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"; private string usaLayerUri = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer...