Selecting a Row on the Grid should expand the Row using the RowDetailsTemplate to display the content. This makes that Row the Selected Row and sets the value of the DataGrid's SelectedIndex Property.
To collapse the Row set the DataGrid's SelectedIndex Property to -1.