In this section, we'll go over searching content from online layers.
In Chapter 1, Introduction to ArcGIS Runtime, we were introduced to a tool that searched through several layers using a FindTask
constructor. We didn't really discuss how it worked, but we made some changes to it and just enjoyed when it searched through several layers. Let's go over that code in more detail. Here's the code again:
var findTask = new FindTask(new System.Uri(this.USAUri)); var findParameters = new FindParameters(); findParameters.LayerIDs.Add(0); // Cities findParameters.LayerIDs.Add(3); // Counties findParameters.LayerIDs.Add(2); // States findParameters.SearchFields.Add("name"); findParameters.SearchFields.Add("areaname"); findParameters.SearchFields.Add("state_name"); findParameters.ReturnGeometry = true; SpatialReference sr = new SpatialReference(wkid); findParameters.SpatialReference = sr; findParameters.SearchText = this.SearchText; findParameters.Contains = true; FindResult...