// TODO: Optimize implementation // TODO: move logic to public api // It should be possible creating/opening extended tabs from code private void OnShowExtendedEditor(object sender, ExecutedRoutedEventArgs e) { var value = e.Parameter as PropertyItemValue; if (value == null) { return; } var property = value.ParentProperty; if (property == null) { return; } // Try getting already opened extended tab var extendedTab = FindExtendedEditorTab(property); if (extendedTab != null) { // Activate alreay opened tab SelectedItem = extendedTab; } else { // TODO: Access the PropertyGrid to get TypeEditor or PropertyEditor ExtendedTemplate here! // Check whether property value editor is actually an extended one if (property.Editor.ExtendedTemplate == null) { return; } // create new extended tab, add to the tabs collection and activate it extendedTab = new ExtendedPropertyEditorTab(property); // Try inserting extended tab after currently selected one if (SelectedItem != null) { Items.Insert(Items.IndexOf(SelectedItem) + 1, extendedTab); } else { Items.Add(extendedTab); } // Activate extended tab SelectedItem = extendedTab; } }
// TODO: Optimize implementation // TODO: move logic to public api // It should be possible creating/opening extended tabs from code private void OnShowExtendedEditor(object sender, ExecutedRoutedEventArgs e) { var value = e.Parameter as PropertyItemValue; if (value == null) return; var property = value.ParentProperty; if (property == null) return; // Try getting already opened extended tab var extendedTab = FindExtendedEditorTab(property); if (extendedTab != null) { // Activate alreay opened tab SelectedItem = extendedTab; } else { // TODO: Access the PropertyGrid to get TypeEditor or PropertyEditor ExtendedTemplate here! // Check whether property value editor is actually an extended one if (property.Editor.ExtendedTemplate == null) return; // create new extended tab, add to the tabs collection and activate it extendedTab = new ExtendedPropertyEditorTab(property); // Try inserting extended tab after currently selected one if (SelectedItem != null) Items.Insert(Items.IndexOf(SelectedItem) + 1, extendedTab); else Items.Add(extendedTab); // Activate extended tab SelectedItem = extendedTab; } }