ArcGISWindowsPhoneSDK.Find.ExecuteButton_Click C# (CSharp) Method

ExecuteButton_Click() private method

private ExecuteButton_Click ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        private void ExecuteButton_Click(object sender, RoutedEventArgs e)
        {
            GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
            graphicsLayer.ClearGraphics();

            FindTask findTask = new FindTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer");
            findTask.Failed += FindTask_Failed;

            FindParameters findParameters = new FindParameters();
            // Layer ids to search
            findParameters.LayerIds.AddRange(new int[] { 0, 1, 2 });
            // Fields in layers to search
            findParameters.SearchFields.AddRange(new string[] { "CITY_NAME", "NAME", "SYSTEM", "STATE_ABBR", "STATE_NAME" });

            // Bind data grid to find results.  Bind to the LastResult property which returns a list
            // of FindResult instances.  When LastResult is updated, the ItemsSource property on the
            // will update.
            Binding resultFeaturesBinding = new Binding("LastResult");
            resultFeaturesBinding.Source = findTask;
            DataListBox.SetBinding(ListBox.ItemsSourceProperty, resultFeaturesBinding);

            findParameters.SearchText = FindText.Text;
            findTask.ExecuteAsync(findParameters);

            // Since binding to DataGrid, handling the ExecuteComplete event is not necessary.
        }