void locator_FindCompleted(object sender, LocatorFindEventArgs e) { GraphicsLayer graphicsLayer = (MyMap.Layers["MyRouteGraphicsLayer"] as GraphicsLayer); if (e.Result != null) { LocatorFindResult findResult = e.Result; Graphic graphicLocation = findResult.Locations[0].Graphic; graphicLocation.Geometry.SpatialReference = MyMap.SpatialReference; graphicLocation.Attributes.Add("name", findResult.Locations[0].Name); _stops.Add(graphicLocation); if ((string)e.UserState == "from") { graphicLocation.Symbol = LayoutRoot.Resources["FromSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; //Geocode to address _locator.FindAsync(ParseSearchText(ToTextBox.Text), "to"); } else { graphicLocation.Symbol = LayoutRoot.Resources["ToSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; //Get route between from and to _routeParams.OutSpatialReference = MyMap.SpatialReference; _routeTask.SolveAsync(_routeParams); } graphicsLayer.Graphics.Add(graphicLocation); } }