WPF 中获取DataGrid 模板列中控件的对像
#region 当前选定行的TextBox获得焦点
/// <summary>
/// 当前选定行的TextBox获得焦点
/// </summary>
public void SelectedRowTBFocus()
{
if (SelectIndex != -)
{
FrameworkElement item = grid.Columns[].GetCellContent(grid.Items[SelectIndex]);
DataGridTemplateColumn temp = (grid.Columns[] as DataGridTemplateColumn);
SelectTB = temp.CellTemplate.FindName("FinCode", item) as TextBox;
SelectTB.Focus();
}
}
#endregion
获取当前选定行的TextBox对象