Bind datagrid with Graphics layer

2073
1
10-05-2011 07:53 AM
MarcoRosa
New Contributor
HI to all,
it's possible to bind datagrid with graphics layer ?

this is my code:

MyGrid.Columns.Add(new DataGridTextColumn() {
  CanUserSort = true,
  SortMemberPath = "NAME",
  Binding = new System.Windows.Data.Binding("Attributes[NAME]"),
  Header = "NAME"
});

MyGrid.Columns.Add(new DataGridTextColumn());
MyGrid.ItemsSource = MyGraphicLayer.Graphics;


doesn't work, an error is fired
MyGraphicLayer has graphics obj with attribute NAME set correctly
What can be problem ?

Thanks a lot GP
0 Kudos
1 Reply
JenniferNery
Esri Regular Contributor
You can use FeatureDataGrid and bind GraphicsLayer property as in this SDK sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureDataGrid

This also works with GraphicsLayer, not just FeatureLayer.

  <esri:FeatureDataGrid Grid.Row="2" x:Name="MyDataGrid"
    Map="{Binding ElementName=MyMap}"
    GraphicsLayer="{Binding ElementName=MyMap, Path=Layers.[California]}" />
0 Kudos