Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我们在最后一行的最后一列上按制表符,WPF DataGrid 会添加一个新行。但添加新行后,焦点将移至网格的顶行。我们如何确保焦点移动到新行的第一列?
你可以尝试类似的东西
this.SelectRowCell(this.Items.Count - 1, 0);
但我不确定这是否也会成为焦点。如果没有,请尝试以下操作:
DataGridCell cell = this.GetCell(this.Items.Count - 1, 0); if (cell != null) { cell.Focus(); }