private void projectTree_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e) { e.CancelEdit = true; if (e.Node.Tag != null) { ProjectTreeItem treeItem = ((ProjectTreeItem)e.Node.Tag); if (treeItem.AllowLabelEdit) { e.CancelEdit = false; // This hack is to allow the tree to display "5: Fifth view" // but when you edit it, the user only edits "Fifth view" string editableText = (string)treeItem.LabelTextProperty.GetValue(treeItem.LabelTextDataSource, null); treeItem.LabelTextBeforeLabelEdit = editableText; Hacks.SetTreeViewEditText(_projectTree, editableText); } } }
public bool SelectTabInPropertyGrid(string tabName) { int tabIndex = 0; foreach (System.Windows.Forms.Design.PropertyTab propertyTab in propertiesGrid.PropertyTabs) { if (propertyTab.TabName == tabName) { if (propertyTab != propertiesGrid.SelectedTab) { Hacks.SetSelectedTabInPropertyGrid(propertiesGrid, tabIndex); } return(true); } tabIndex++; } return(false); }