This can be done by adding a behaviour to DataGrid like so:
<sdk:DataGrid>
<i:InteractionBehaviors>
<Behaviors:BrowserSelectedDataGridRowSelectsCellInSpecificRow ColumnNumber="1"/>
</i:Interaction.Behaviors>
<sdk:DataGrid>
where ColumnNumber specifies the column number to focus.
void DataGridSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (AssociatedObject.SelectedItem == null)
return;
AssociatedObject.UpdateLayout();
//AssociatedObject.ScrollIntoView(item, (DataGridColumn)Target.Columns[ColumnIndexForEdit]);
AssociatedObject.Focus();
AssociatedObject.CurrentColumn = AssociatedObject.Columns[ColumnNumber];
AssociatedObject.BeginEdit();
}
source
No comments:
Post a Comment
If you like this post, please leave a comment :)