// Token: 0x060046F8 RID: 18168 RVA: 0x00141F1C File Offset: 0x0014011C
        private static void OnAnyGotFocus(object sender, RoutedEventArgs e)
        {
            DataGridCell dataGridCell = DataGridHelper.FindVisualParent <DataGridCell>(e.OriginalSource as UIElement);

            if (dataGridCell != null && dataGridCell == sender)
            {
                DataGrid dataGridOwner = dataGridCell.DataGridOwner;
                if (dataGridOwner != null)
                {
                    dataGridOwner.FocusedCell = dataGridCell;
                }
            }
        }
示例#2
0
        private static void OnAnyLostFocus(object sender, RoutedEventArgs e)
        {
            // Get the ancestor cell of old focused element.
            // Set DataGrid.FocusedCell to null, if the cell doesn't
            // have keyboard focus.
            DataGridCell cell = DataGridHelper.FindVisualParent <DataGridCell>(e.OriginalSource as UIElement);

            if (cell != null && cell == sender)
            {
                DataGrid owner = cell.DataGridOwner;
                if (owner != null && !cell.IsKeyboardFocusWithin && owner.FocusedCell == cell)
                {
                    owner.FocusedCell = null;
                }
            }
        }