Select to view content in your preferred language

How to show OBJECTID column in feature data grid

738
2
Jump to solution
05-17-2012 08:41 AM
MattMiley
Deactivated User
How do I show a OBJECTID column in feature data grid.

My attempted below..

<esriToolkit:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid" SelectionChanged="Feature_DataGrid_SelectionChange"        Map="{Binding ElementName=MyMap}"        GraphicsLayer="{Binding Layers.[Job Points], ElementName=MyMap}" >              <esriToolkit:FeatureDataGrid.Columns>                     <sdk:DataGridTextColumn Width="100" Binding="{Binding  Attributes[OBJECTID]}" Header="Job ID"/>                 </esriToolkit:FeatureDataGrid.Columns>             </esriToolkit:FeatureDataGrid>
0 Kudos
1 Solution

Accepted Solutions
ChristopherHill
Deactivated User
How do I show a OBJECTID column in feature data grid. 

My attempted below.. 

<esriToolkit:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid" SelectionChanged="Feature_DataGrid_SelectionChange"        Map="{Binding ElementName=MyMap}"        GraphicsLayer="{Binding Layers.[Job Points], ElementName=MyMap}" >              <esriToolkit:FeatureDataGrid.Columns>                     <sdk:DataGridTextColumn Width="100" Binding="{Binding  Attributes[OBJECTID]}" Header="Job ID"/>                 </esriToolkit:FeatureDataGrid.Columns>             </esriToolkit:FeatureDataGrid>



The ItemsSource of the FeatureDataGrid in silverlight does not contain graphics. It contains a PageViewCollection of a reflection class that is built based on the number unique attribute names inside all of your Graphic.Attributes.Keys. Your binding should not include Attributes.
<sdk:DataGridTextColumn Width="100" Binding="{Binding  Attributes[OBJECTID]}" Header="Job ID"/>

View solution in original post

0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
Have you seen this SDK sample? http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureDataGrid

Few things to note in this sample, FeatureDataGrid Map and GraphicsLayer property (see element binding) and FeatureLayer.OutFields. In this sample, it is "*" which means show all fields. Otherwise, if you only want ObjectID to show, change FeatureLayer.OutFields="ObjectID".
0 Kudos
ChristopherHill
Deactivated User
How do I show a OBJECTID column in feature data grid. 

My attempted below.. 

<esriToolkit:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid" SelectionChanged="Feature_DataGrid_SelectionChange"        Map="{Binding ElementName=MyMap}"        GraphicsLayer="{Binding Layers.[Job Points], ElementName=MyMap}" >              <esriToolkit:FeatureDataGrid.Columns>                     <sdk:DataGridTextColumn Width="100" Binding="{Binding  Attributes[OBJECTID]}" Header="Job ID"/>                 </esriToolkit:FeatureDataGrid.Columns>             </esriToolkit:FeatureDataGrid>



The ItemsSource of the FeatureDataGrid in silverlight does not contain graphics. It contains a PageViewCollection of a reflection class that is built based on the number unique attribute names inside all of your Graphic.Attributes.Keys. Your binding should not include Attributes.
<sdk:DataGridTextColumn Width="100" Binding="{Binding  Attributes[OBJECTID]}" Header="Job ID"/>
0 Kudos