private void LabelBox_KeyDown(object sender, KeyEventArgs e) { if ((e.Key == Key.Return || e.Key == Key.Enter) && sender is TextBox textbox) { NewToDoTextBox.Focus(); } }
public MainWindow() { InitializeComponent(); readerWriter = new ReaderWriter(); todos = readerWriter.LoadToDos(); NewToDoTextBox.MaxLength = ToDo.MaxNameLenght; NewToDoTextBox.Focus(); DisplayToDoList(); }
private void AddToDoButton_Click(object sender, RoutedEventArgs e) { if (NewToDoTextBox.Text != "") { todos.Add(new ToDo(NewToDoTextBox.Text, false)); ToDoListView.Items.Refresh(); readerWriter.SaveToDos(todos); NewToDoTextBox.Text = ""; ScrollListToBottom(); } NewToDoTextBox.Focus(); }