private void mnuNewNote_Click(object sender, RoutedEventArgs e) { NoteItem creatednote = new NoteItem("New Note", ""); _Notes.Add(creatednote); lstNotes.SelectedItems.Clear(); lstNotes.SelectedItems.Add(creatednote); }
private void mnuNotesNew_Click(object sender, RoutedEventArgs e) { //add an item. //lstNotes.SelectedIndex = lstNotes.ItemsSource .Add(new NoteItem("New Note","")); var creatednote = new NoteItem("New Note"); _Notes.Add(creatednote); // lstNotes.SelectedItem = creatednote; }
private void mnuNotesNew_Click(object sender, RoutedEventArgs e) { if (_Notes == null) { _Notes = new ObservableCollection<NoteItem>(); lstNotes.ItemsSource = _Notes; } //add an item. //lstNotes.SelectedIndex = lstNotes.ItemsSource .Add(new NoteItem("New Note","")); var creatednote = new NoteItem("New Note"); _Notes.Add(creatednote); // lstNotes.SelectedItem = creatednote; }