public static TextBlock GetTextBlock(DataGridRow rowContainer, int column) { DataGridCellsPresenter presenter = FindControl.FindChild <DataGridCellsPresenter>(rowContainer, string.Empty); DataGridCell datagridCell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column); return(GetTextBlock(datagridCell)); }
public static TextBlock GetTextBlock(DataGridCell datagridCell) { var framework = FindControl.FindChild <FrameworkElement>((ContentPresenter)datagridCell.Content, string.Empty); var textBlock = framework as TextBlock; return(textBlock); }
public static DataGridCell GetCell(DataGrid datagrid, int row, int column) { DataGridRow rowContainer = GetRow(datagrid, row); if (rowContainer != null) { DataGridCellsPresenter presenter = FindControl.FindChild <DataGridCellsPresenter>(rowContainer, string.Empty); if (presenter == null) { datagrid.ScrollIntoView(rowContainer, datagrid.Columns[column]); presenter = FindControl.FindChild <DataGridCellsPresenter>(rowContainer, string.Empty); } DataGridCell cell = (DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column); return(cell); } return(null); }