private void FeatureTypeListBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { int index = FeatureTypeListBox.SelectedIndex; if (index > -1) { CVDTemplateItem selectedTemplate = FeatureTypeListBox.SelectedItem as CVDTemplateItem; if (editor.Add.CanExecute(selectedTemplate.ID)) { editor.Add.Execute(selectedTemplate.ID); } FeatureTypeChoicesPage.IsOpen = false; } }