private void EditItem_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     int idx = this.listBox.SelectedIndex;
     var e2 = new ItemEventArgs(this.collection[idx]);
     this.EditItem(this, e2);
     if(!e2.Cancel){
         this.collection[idx] = e2.Item;
         this.listBox.SelectedIndex = idx;
     }
 }
 private void AddItem_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     var e2 = new ItemEventArgs();
     this.AddItem(this, e2);
     if(!e2.Cancel){
         this.collection.Insert(this.listBox.SelectedIndex + 1, e2.Item);
         if(this.listBox.SelectedIndex < 0){
             this.listBox.SelectedIndex = 0;
         }
     }
 }