WPF: How do I set the focus on a datagrid?

Posted by Jonathan Allen on Stack Overflow See other posts from Stack Overflow or by Jonathan Allen
Published on 2010-03-19T22:00:18Z Indexed on 2010/03/19 22:01 UTC
Read the original article Hit count: 434

Filed under:
|
|

I would like to set the focus on the first row of a data grid.

This is what I have so far:

Keyboard.Focus(ResultsGrid)
If result.Count > 0 Then
    ResultsGrid.SelectedIndex = 0
End If

This will set the focus to the datagrid, but not the row itself.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about wpftoolkit