Select to view content in your preferred language

FeatureDataGrid: field aliases and selected items

820
2
08-31-2010 11:42 AM
AlexZlotin
Emerging Contributor
I have a couple of questions related to the FeatureDataGrid control:

1. When I bind a feature dataset to my FeatureDataGrid programmatically (dataGrid.FilterSource = featureSet.Features;), the grid is properly populated with feature attributes, but the column headers are showing database column names rather than aliases set in the MXD. How can field aliases be shown in the grid column headers programmatically (not in XAML)?

2. When working with selected items in the grid, it is possible to get hold of the graphic object represented by a selected item? The examples I have seen only show how to get values for particular attributes of a selected item (graphic).

Thanks for any insights.
Alex
0 Kudos
2 Replies
AliMirzabeigi
Emerging Contributor
Alex,

Field alias names are only populated when your FeatureDataGrid is associated with a FeatureLayer. FeatureSet does not contain any field information therefore; FeatureDataGrid uses the attribute names of your graphic objects.
Regarding your second question there is a "SelectedGraphics" property in FeatureDataGrid control that you can use.
0 Kudos
AlexZlotin
Emerging Contributor
Thanks for the help, Ali.

The FeatureSet object returned by the query task does contain field alias information (FeatureSet.FieldAliases). However, FeatureGrid only takes FeatureSet.Features, so it is clear why aliases are not being used.

I will try creating a copy of the features collection returned by the task, with aliases as column names, and pass it to the data grid.
0 Kudos