I'm very new to WPF, so new that I can't seen to find a way to get a value from my datagrid control. I figure something as simple as this should take no more than 2 lines at most, but after many google searches I got nothing. Basically I'm looking to get the value of the first column of the selected row.
Code-behind:
Some debugging showed me that row.Item contains what I'm looking for (an array of strings with the selected row values) but I can't seen to find a way to get these values.
Any help appreciated, thanks.
Code:
<DataGrid Name="dgData" SelectedValuePath="Number" AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="6,6,0,0" VerticalAlignment="Stretch" Width="556" >
Code-behind:
Code:
void onDoubleClickEvent(...)
{
var row = sender as DataGridRow;
//string test = (string)dgData.SelectedItems[0];
//System.Data.DataRowView test200 =(System.Data.DataRowView)dgData.SelectedItems[0];
//string test201 = (string)test200["Number"];
//Defect d = (Defect)dgData.SelectedItem;
//setStatus("" , 0);
}
Some debugging showed me that row.Item contains what I'm looking for (an array of strings with the selected row values) but I can't seen to find a way to get these values.
Any help appreciated, thanks.