private void AddButton_Click(object sender, RoutedEventArgs e) { if (MenuBuffer.Text != "" && MenuBuffer.Text != "Add Menu") { Content.Items.Add(MenuBuffer.Text); MenuBuffer.Clear(); MenuBuffer.Focus(); } }
private void MenuBuffer_GotFocus(object sender, RoutedEventArgs e) { if (MenuBuffer.Text == "Add Menu") { MenuBuffer.Clear(); } MenuBuffer.IsUndoEnabled = true; MenuBuffer.PreviewKeyDown += MenuNames_PreviewKeyDown; }
void MenuNames_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (MenuBuffer.Text != "Add Menu" && MenuBuffer.Text != "") { Content.Items.Add(MenuBuffer.Text); MenuBuffer.Clear(); MenuBuffer.Focus(); } } }