protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
        {
            base.OnIsKeyboardFocusWithinChanged(e);

            bool newValue = ( bool )e.NewValue;

            if (newValue == true)
            {
                DataGridContext dataGridContext = DataGridControl.GetDataGridContext(this);

                if (dataGridContext != null)
                {
                    object item = dataGridContext.GetItemFromContainer(this);

                    if ((item != null) && (dataGridContext.InternalCurrentItem != item))
                    {
                        try
                        {
                            dataGridContext.SetCurrent(item, null, -1, dataGridContext.CurrentColumn, true, true, false);
                        }
                        catch (DataGridException)
                        {
                            // We swallow the exception if it occurs because of a validation error or Cell was read-only or
                            // any other GridException.
                        }
                    }
                }
            }
        }