private static DataGridRow GetRow(DataGrid grid, int index) { var row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index); if (row == null) { // May be virtualized, bring into view and try again. grid.UpdateLayout(); if (index >= grid.Items.Count) { index = grid.Items.Count - 1; } grid.ScrollIntoView(grid.Items[index]); row = (DataGridRow)grid.ItemContainerGenerator.ContainerFromIndex(index); } return row; }
No comments:
Post a Comment