예제 #1
0
        private DataGridCell GetCell(DataGridRow row, int columnIndex = 0)
        {
            if (row == null)
            {
                return(null);
            }

            var presenterE = row.FindChildren <DataGridCellsPresenter>(true);

            if (presenterE == null)
            {
                return(null);
            }

            var presenter = presenterE.ToList()[0];
            var cell      = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(columnIndex);

            if (cell != null)
            {
                return(cell);
            }

            // alternative way - now try to bring into view and retreive the cell
            this.InstalledAssembliesDataGrid.ScrollIntoView(row, this.InstalledAssembliesDataGrid.Columns[columnIndex]);
            cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(columnIndex);

            return(cell);
        }