Reputation: 7692
I can set the focus with only XAML to a Datagrid.
It eludes me how (if possible at all) how to set focus to the first row with only XAML.
My (shortened) XAML:
<Window x:Class="WhatIsInTheBarnBooth.MainWindow"
...
FocusManager.FocusedElement="{Binding ElementName=grdData}">
</Window>
<DataGrid Name="grdData">
...
</DataGrid>
Upvotes: 3
Views: 1078
Reputation: 10226
Can you try....
FocusManager.FocusedElement="{Binding ElementName=myDataGrid}"
and
<DataGrid Name="grdData" SelectedIndex="0">
...
</DataGrid>
Upvotes: 1