un selecting graphics from the SelectionGraphicLayer in 10.2 ArcGIS Mobile

3669
1
03-10-2015 03:20 PM
MuralidharMoka
New Contributor II

Hi,

We are migrating from ArcGIS Mobile 10.0 to 10.3. This is a WPF application we have install ArcGIS Mobile 10.2.1(we have no issues with the instllation)

         

  Problem:  We are trying to UnSelect graphics after we draw an envelope. We want to select only a single graphic after selection, So we remove the other graphics like this. but the 10.2  code does not work. it throws an out of range exception.

10.0 code looked like this.

                //remove other geometries from the selection graphic layer

                int n = selectMapAction.SelectionGraphicLayer.SelectedGeometries.Count;

               for (int i = n - 1; i > 0; i--)

                {

                        selectMapAction.SelectionGraphicLayer.SelectedGeometries.RemoveAt(i);  //works

                  }

10.2 code is modified like this,

                int n = selectMapAction.SelectionGraphicLayer.Graphics.Count;

             for (int i = n - 1; i > 0; i--)

                {

                selectMapAction.SelectionGraphicLayer.Graphics.RemoveAt(i);    //gives out of range exception.

                }

But the 10.2 code gives an exception. Any one please let us know what is the correct code

Thanks

Muralidhar Moka

0 Kudos
1 Reply
MuralidharMoka
New Contributor II

Hi All,

  To explain the above question simply.

         How do I remove or delete  graphics from a SelectionGraphicLayer.Graphics  (in 10.2 SDK latest)

The below one fails

===============

                  int n = selectMapAction.SelectionGraphicLayer.Graphics.Count;

                  for (int i = n - 1; i > 0; i--)

                  {

                     selectMapAction.SelectionGraphicLayer.Graphics.RemoveAt(i);    //gives out of range exception.

                   }

This was working in older 10.0 sdk.

Thanks

Muralidhar Moka

0 Kudos