My scenario: Data loads in to my data grid page by page On key down of the last row on w pf data grid, i will load another row in the end. this way after binding with the new rows after key down focus on the last selected cell is lost. i want to retain the selection on the last+1 (row and column) cell. How can i set this.
There is event SourceUpdated
, so you could do something like that:
private void DataGrid_SourceUpdated(object sender, DataTransferEventArgs e)
{
(sender as DataGrid).SelectedIndex = (sender as DataGrid).Items.Count - 1;
}
It could help also: How to select a row or a cell in WPF DataGrid programmatically?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.