I use WPF Metro datagrid. When I use DataGridRow for Getting data from selected row content, Always Null data is returned at var 'rowview'. What is my problem?
This is my code.
private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
IInputElement element = e.MouseDevice.DirectlyOver;
if (element != null && element is FrameworkElement)
{
if (((FrameworkElement)element).Parent is DataGridCell)
{
DataGrid grid = sender as DataGrid;
if (grid != null && grid.SelectedItems != null && grid.SelectedItems.Count == 1)
{
DataGridRow rowview = grid.SelectedItem as DataGridRow;
if (rowview != null)
{
ProjectInfo addJobWindow = new ProjectInfo();
addJobWindow.ShowDialog();
}
}
}
}
}
<DataGrid x:Name="DgProjectInfo" ItemsSource="{Binding Projects}"
AutoGenerateColumns="False" Margin="-11,11,211,-1" MouseDoubleClick="DataGrid_MouseDoubleClick" IsReadOnly="True">