如何将数据网格单元的焦点移动到wpf中的下一个单元格 [英] How to move focus of datagrid cell to next cell in wpf
本文介绍了如何将数据网格单元的焦点移动到wpf中的下一个单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将数据网格单元格的焦点移动到wpf中的下一个单元格
解决方案
SelectionUnit =CellIsSynchronizedWithCurrentItem =True设置DataGrid的上述属性,并在后面的代码中进行以下更改。
DataGridCellInfo info = new DataGridCellInfo(this.dataGrid.Items [2],this.dataGrid.Columns [1]);
this.dataGrid.CurrentCell = info;
this.dataGrid.SelectedCells.Clear();
this.dataGrid.BeginEdit();
this.dataGrid.CommitEdit();
this.dataGrid.CurrentItem = info.Item;
this.dataGrid.SelectedCells.Add(info);
希望有所帮助。
问候,
Kannan。小号
How to move focus of datagrid cell to next cell in wpf
解决方案
Hi,
SelectionUnit="Cell" IsSynchronizedWithCurrentItem="True"Set the above properties for DataGrid and in the code behind do the following changes.
DataGridCellInfo info = new DataGridCellInfo(this.dataGrid.Items[2], this.dataGrid.Columns[1]); this.dataGrid.CurrentCell = info; this.dataGrid.SelectedCells.Clear(); this.dataGrid.BeginEdit(); this.dataGrid.CommitEdit(); this.dataGrid.CurrentItem = info.Item; this.dataGrid.SelectedCells.Add(info);
Hope it helps.
Regards,
Kannan. S
这篇关于如何将数据网格单元的焦点移动到wpf中的下一个单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文