1
my DataGrid SelectionMode = "Single"설명 열이나 다른 열의 셀을 클릭 할 때마다 첫 번째 셀의 셀 포커스를 전환해야합니다.wpf datagrid 첫 번째 셀을 프로그래밍 방식으로 선택
이 내가
private void dgvConfig_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
DependencyObject dep = (DependencyObject)e.OriginalSource;
// iteratively traverse the visual tree
while ((dep != null) &&
!(dep is DataGridCell) &&
!(dep is DataGridColumnHeader))
{
dep = VisualTreeHelper.GetParent(dep);
}
if (dep == null)
return;
if (dep is DataGridColumnHeader)
{
string columnHead = "";
DataGridColumnHeader columnHeader = dep as DataGridColumnHeader;
columnHead = columnHeader.Column.Header.ToString();
LoadGridview(columnHead);
//MessageBox.Show(columnHeader.Column.DisplayIndex.ToString());
}
if (dep is DataGridCell)
{
DataGridCell cell = dep as DataGridCell;
string cellName = cell.Column.Header.ToString();
if (cellName.Equals("Description"))
{
cell.Focus();
string datagridselect;
//datagridselect = DataGrid.SelectedIndexProperty[]
//var cellInfo = dgvConfig.SelectedCells[0];
//var xt = dgvConfig.CurrentCell.Column.
// the prob is I cant seem to access an array to move the focus to the first column of that selected row
}
}
}
대! 많은 감사합니다 !!! –