Currently I have a datagrid that is populated with database info. When you double click a row I have been able to successfully handle programically but now I am trying to tackle passing data. Is there anyway to accomplish this using my current setup or do I need to re-write the way I am handling the double click.
Here is the XAML.
<DataGrid Name="DgMain" HorizontalAlignment="Stretch" Height="auto" Margin="10,43" VerticalAlignment="Stretch" Width="auto"
AutoGenerateColumns="True" ItemsSource="{Binding}" SelectionChanged="DgMain_SelectionChanged"
SelectedItem="{Binding SelectedItem}" SelectionMode="Single" SelectionUnit="FullRow" IsSynchronizedWithCurrentItem="True" CanUserAddRows="False" CanUserDeleteRows="False"
IsReadOnly="True" EnableRowVirtualization="True">
<DataGrid.Resources>
<Style TargetType="DataGridRow">
<EventSetter Event="MouseDoubleClick" Handler="DgMain_DoubleClick"/>
</Style>
</DataGrid.Resources>
</DataGrid>
Here is the code behind.
private void DgMain_DoubleClick(object sender, MouseButtonEventArgs e)
{
MessageBox.Show(sender.ToString());
}
This code works, I get the Messagebox showing that the sender is the DataGrid, I am stuck on how to check the item that was click though. Thanks in advance for any help.