//When selection changed in combobox (pressing arrow key down or up) must be synchronized with opened DataGrid popup protected override void OnSelectionChanged(SelectionChangedEventArgs e) { IstextChanged = true; base.OnSelectionChanged(e); if (popupDataGrid == null) { IstextChanged = false; return; } if (!DesignerProperties.GetIsInDesignMode(this)) { if (IsDropDownOpen) { if (this.SelectedItem != null) { popupDataGrid.SelectedItem = this.SelectedItem; } if (popupDataGrid.SelectedItem != null && !IsPartiralData) { popupDataGrid.ScrollIntoView(popupDataGrid.SelectedItem); } } } if (!IsintextChanged) { IstextChanged = false; } }
public static Microsoft.Windows.Controls.DataGridCell GetCell(this Microsoft.Windows.Controls.DataGrid grid, Microsoft.Windows.Controls.DataGridRow row, int column) { if (row != null) { DataGridCellsPresenter presenter = GetVisualChild <DataGridCellsPresenter>(row); if (presenter == null) { grid.ScrollIntoView(row, grid.Columns[column]); presenter = GetVisualChild <DataGridCellsPresenter>(row); } Microsoft.Windows.Controls.DataGridCell cell = (Microsoft.Windows.Controls.DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column); return(cell); } return(null); }