void propertyGridUserOption_UserOptionNameChanged(object sender, TextChangedEventArgs e) { UserOption option = propertyGridUserOption.UserOption; if (!userOptionNodes.ContainsKey(option)) return; Node node = userOptionNodes[option]; node.Name = node.Text = option.VariableName; }
void propertyGridUserOption_UserOptionNameChanged(object sender, TextChangedEventArgs e) { UserOption option = formUserOptionDetails.UserOption; if (!virtualPropertyNodes.ContainsKey(option)) return; Node node = virtualPropertyNodes[option]; node.Name = node.Text = option.VariableName; }
private void propertyGridUserOption_UserOptionCategoryChanged(object sender, TextChangedEventArgs e) { IgnoreSelectionChanged = true; UserOption option = propertyGridUserOption.UserOption; if (!userOptionCategoryNodes.ContainsKey(e.OldText)) return; if (!userOptionNodes.ContainsKey(option)) return; Node optionNode = userOptionNodes[option]; Node currentCatNode = userOptionCategoryNodes[e.OldText]; if (currentCatNode.Nodes.Count == 1) { if (userOptionCategoryNodes.ContainsKey(option.Category)) { currentCatNode.Nodes.Remove(optionNode); currentCatNode.Remove(); userOptionCategoryNodes.Remove(e.OldText); Node newCatNode = FindOrCreateCategoryNode(option.Category); newCatNode.Nodes.Add(optionNode); } else { userOptionCategoryNodes.Remove(e.OldText); currentCatNode.Name = option.Category; currentCatNode.Text = FormatCategoryName(option.Category); userOptionCategoryNodes.Add(option.Category, currentCatNode); } } else { // Shift the option node to its new category node. Node newCatNode = FindOrCreateCategoryNode(option.Category); currentCatNode.Nodes.Remove(optionNode); newCatNode.Nodes.Add(optionNode); } Project.Instance.IsDirty = true; optionNode.EnsureVisible(); treeOptions.SelectedNode = optionNode; IgnoreSelectionChanged = false; }