Please help me, Im trying to get the value of Cell[0] from the selected row in a SelectionChangedEvent.
I am only managing to get lots of different Microsoft.Windows
Less code, and it works.
private void datagrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
DataGrid dataGrid = sender as DataGrid;
DataGridRow row = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromIndex(dataGrid.SelectedIndex);
DataGridCell RowColumn = dataGrid.Columns[ColumnIndex].GetCellContent(row).Parent as DataGridCell;
string CellValue = ((TextBlock)RowColumn.Content).Text;
}
ColumnIndex is the index of the column you want to know.