Solved! Go to Solution.
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
<esri:FeatureDataGrid Grid.Row="3" Grid.ColumnSpan="3" x:Name="MyDataGrid" Map="{Binding ElementName=MyMap}" MaxHeight="400" AutoGenerateColumns="True" GraphicsLayer="{Binding Layers.[MyFeatureLayer], ElementName=MyMap}" > <esri:FeatureDataGrid.Columns> <sdk:DataGridTextColumn Binding="{Binding OBJECTID}" Width="Auto" Header="Object ID"/> </esri:FeatureDataGrid.Columns> </esri:FeatureDataGrid>
<sdk:DataGridTextColumn Binding="{Binding OBJECTID}" Width="Auto" Header="Object ID"/>
// Don't show object id field. if (featureLayer.LayerInfo.ObjectIdField == mappedKey) { e.Cancel = true; return; }
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
<esri:FeatureDataGrid Grid.Row="3" Grid.ColumnSpan="3" x:Name="MyDataGrid" Map="{Binding ElementName=MyMap}" MaxHeight="400" AutoGenerateColumns="True" GraphicsLayer="{Binding Layers.[MyFeatureLayer], ElementName=MyMap}" > <esri:FeatureDataGrid.Columns> <sdk:DataGridTextColumn Binding="{Binding OBJECTID}" Width="Auto" Header="Object ID"/> </esri:FeatureDataGrid.Columns> </esri:FeatureDataGrid>
<sdk:DataGridTextColumn Binding="{Binding OBJECTID}" Width="Auto" Header="Object ID"/>
// Clear the columns fdgAttributes.Columns.Clear(); // Add the new objectID field ESRI.ArcGIS.Client.FeatureLayer fl = _vm.SelectedLayer; DataGridTextColumn col = new DataGridTextColumn(); col.Header = fl.LayerInfo.ObjectIdField; col.Binding = new System.Windows.Data.Binding(fl.LayerInfo.ObjectIdField); fdgAttributes.Columns.Add(col); // Set my featuredatagrid graphics layer fdgAttributes.GraphicsLayer = _vm.SelectedLayer as GraphicsLayer;