简体   繁体   中英

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   | Keyword2    |     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

使用DataGrid.SelectedItem属性获取绑定到所选行的数据。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM