Getting row information after a doubleclick
You can alternatively do this:
<DataGrid>
<DataGrid.RowStyle>
<Style TargetType="DataGridRow">
<Setter Property="cal:Message.Attach" Value="[MouseDoubleClick] = [Action RowSelect($dataContext)]"/>
</Style>
</DataGrid.RowStyle>
</DataGrid>
Then
public void RowSelect(MoviesListItem movie)
{
//now how to access the selected row after the double click event?
}
(hope it will help) I am not sure about your case, but this is what I do in winforms:
int index = dataGridView2.CurrentRow.Index; //determine which item is selected
textBox8.Text = dataGridView2.Rows[index].Cells[0].Value.ToString(); //add login
You can just pass $dataContext on your XAML:
cal:Message.Attach="[Event MouseDoubleClick] = [Action RowSelect($dataContext)]">
And change your method to:
public void RowSelect(MoviesListItem movie)
{
//now how to access the selected row after the double click event?
}
//EDIT Sorry, the above solution will work only if the action is on the datatemplate itself... another solution would be to have a SelectedItem bind and just use it on your method:
<DataGrid
SelectedItem="{Binding SelectedMovie,Mode=TwoWay}"
cal:Message.Attach="[Event MouseDoubleClick] = [Action RowSelect()]">
and on your code:
public void RowSelect()
{
//SelectedMovie is the item where the user double-cliked
}