Silverlight C# - How to get value of row/cell clicked on in DataGrid?
I've got a DataGrid that I'm populating with data, and I'd like to copy the value of the cell clicked on into a string. Better yet, I'd like to copy the value out of a specific cell in the row, so if there's a way to load the entire row into an array that'd be better.
For instance I'd have a few rows like this:
Included | Keyword | Occurrences | Density
------------------------------------------------
Yes | KW1 | 3 | 1.02%
Yes | Keywo开发者_C百科rd2 | 1 | 0.25%
Yes | KW1 | 3 | 1.021%
If I were to click anywhere on row 2 I'd like to be able to load the row into an array so that it I'd be able to call gridrow[1] in order to consistently get the value "Keyword2".
Also:
In the older Silverlights, to open up a new webpage I'd use HtmlPage.Navigate, but that doesn't appear to work in Silverlight 4. (Yes, I've loaded System.Windows.Browser; )
Thanks in advance!
-Sootah
Use the DataGrid.SelectedItem Property to get the data bound to the selected row.
精彩评论