First, set the "SelectionChanged" event in your datagrid:
<esri:FeatureDataGrid x:Name="MyDataGrid" SelectionChanged="MyDataGrid_SelectionChanged" />
Next, capture the graphic clicked from the row in the datagrid:
private void MyDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs args)
{
IEnumerable<ESRI.ArcGIS.Client.Graphic> myGraphics = MyDataGrid.SelectedGraphics;
int id = Convert.ToInt32(myGraphics.Last<Graphic>().Attributes["snp_id"]);
/* Now you can pass "id" to other methods or global fields. */
}
Note:
Here I cast it to "integer". You can cast it to your own type that suites your needs. You must cast it, however, for "Attributes" values remain of type object.
Also, you may want to check for "null" or count > 0 before issuing those two commands (weird things happen sometimes).
Hugo.