Select to view content in your preferred language

DataGrid not working well

3666
1
04-05-2015 04:25 AM
Asgharkhan
Regular Contributor

i reproduce attribute query with data grid , every thing is fine but now the problem is when i select the feature its give me invalid cast exception,

this code working well in another query.

  private void FindDetails_SelectionChanged(object sender, SelectionChangedEventArgs e)

        {

            // Highlight the graphic feature associated with the selected row

            DataGrid dataGrid = sender as DataGrid;

            int selectedIndex = dataGrid.SelectedIndex;

            if (selectedIndex > -1)

            {

                FindResult findResult = (FindResult)FindDetailsDataGrid.SelectedItem;

                Graphic graphic = findResult.Feature;

 

                 switch (graphic.Attributes["Shape"].ToString())

                {

  case "Polygon":

                        graphic.Symbol = LayoutRoot.Resources["HighlightFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                        break;

                    case "Polyline":

                        graphic.Symbol = LayoutRoot.Resources["HighlightLineSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                        break;

                    case "Point":

                        graphic.Symbol = LayoutRoot.Resources["PointMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

                        break;

                }

                        graphic.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

0 Kudos
1 Reply
nakulmanocha
Esri Regular Contributor

Which line is throwing the error? Can you share some more code?

0 Kudos