Select to view content in your preferred language

FeatureDataGrid - DataGridRow

582
3
07-06-2010 02:00 PM
bbieb
by
Occasional Contributor
Hi,
I believe this is simple but am having trouble trying to find a solution.  If you have a selected graphic in a feature data grid, how can you retrieve the DataGridRow associated with that graphic??
Thanks.
brian
brian
0 Kudos
3 Replies
bbieb
by
Occasional Contributor
Dominique or Morten?
brian
0 Kudos
AliMirzabeigi
New Contributor
Hello Brian,

You can use SelectedItems property of FeatureDataGrid to get selected rows collection. Here is a code snippet that shows how to retrieve value of a cell in the first selected row:

IList selectedItems = MyFeatureDataGrid.SelectedItems;
object value = selectedItems[0].GetType().GetProperty("YourPropertyName").GetValue(selectedItems[0], null);

Thank you,
Ali
0 Kudos
bbieb
by
Occasional Contributor
Hi Ali,
Thanks for the response.

Still having troubles....
           
For Each g As Object In selectionDataGrid.SelectedItems
     g = g  'g = nothing
Next


What I want to do is the following.

' there was a change done to the selected graphics
' I want to show the user that the change was completed by changing
' the row color and de-selecting the graphic

For Each g As Graphic In selectionDataGrid.SelectedGraphics
    Dim row As DataGridRow ' = get datagrid row for g 
    row.Background = New SolidColorBrush(System.Windows.Media.Colors.Yellow)
Next

For Each g In selectionDataGrid.GraphicsLayer.Graphics
     If g.Selected = True Then
          g.UnSelect()
     End If
Next 


I am using Silverlight API v1.2
Thanks.
brian
brian
0 Kudos