/// <summary> /// Handling textbox backspace input. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TextBox_BackKeyDown(object sender, KeyEventArgs e) { TextBox tb = (TextBox)sender; if (e.Key == Key.Back && tb.Text.Length > 0 && tb.Text.Remove(tb.Text.Length - 1) == string.Empty) { undoStack.Push(sudoku.GetGridCopy()); mnuUndo.IsEnabled = true; redoStack.Clear(); mnuRedo.IsEnabled = false; } }