Select to view content in your preferred language

how to specify the AttributeFields shown with IdentifyTask

690
4
07-14-2010 01:49 AM
UlfGrimhardt
Deactivated User
Hi

With help from the RessourceCenter i implemented a IdentifyTask to my SilverlightApplication. At the Moment the AttributeFields that are identified are shown in a DataGrid. Is it possible to specify the Fields that are shown? At the moment all Fields are Identified and visible, but things like ObjectID and Shape arent really important. How can i specify the shown AttributeFields?
0 Kudos
4 Replies
DominiqueBroux
Esri Frequent Contributor
If your graphics are coming from an identify task, you might remove the useless attributes by code by something like:

 
foreach (IdentifyResult identifyResult in args.IdentifyResults)
{
Graphic graphic = identifyResult.Feature;
graphic.Attributes.Remove("Shape");
graphic.Attributes.Remove("ObjectID");
}


Not sure it's the best way, but no other idea:)
0 Kudos
UlfGrimhardt
Deactivated User
Jepp, that works. Thanks!
0 Kudos
JMcNeil
Deactivated User
If your graphics are coming from an identify task, you might remove the useless attributes by code by something like:

 
foreach (IdentifyResult identifyResult in args.IdentifyResults)
{
Graphic graphic = identifyResult.Feature;
graphic.Attributes.Remove("Shape");
graphic.Attributes.Remove("ObjectID");
}


Not sure it's the best way, but no other idea:)




Salt17 or dbroux....where do I need to add this code?  If I change the foreach loop below I can't get it to work.

  foreach (IdentifyResult result in results)
                {
                    Graphic feature = result.Feature;
                    
                    string title = result.Value.ToString() + " (" + result.LayerName + ")";
                    _dataItems.Add(new DataItem()
                   
                    {
                        Title = title,
                        Data = feature.Attributes
                         
                    });
                    IdentifyComboBox.Items.Add(title);
                }
                IdentifyComboBox.SelectedIndex = 0;
            }
        }
0 Kudos
ChrisBradberry
Deactivated User
You can remove the fields that you don't want in the service itself. Just go to the properties of each feature class in the service, go to the fields tab and uncheck the fields that you do not need.
0 Kudos