/// <summary> /// Updates the tree view node selection according to the currently selected color. /// </summary> protected virtual void UpdateTreeViewSelection() { var selColor = InternalSelectedColor; GuiTreeView.ItemsSource = null; _treeRootNode.FromHereToLeavesDo(node => { node.IsExpanded = false; node.IsSelected = false; }); // deselect and collapse all nodes if (selColor.ParentColorSet != null) { var colorSet = selColor.ParentColorSet; Altaxo.Main.ItemDefinitionLevel level = Altaxo.Main.ItemDefinitionLevel.Project; bool isPlotColorSet = false; if (selColor.ParentColorSet != null && ColorSetManager.Instance.TryGetList(selColor.ParentColorSet.Name, out var colorSetEntry)) { isPlotColorSet = colorSetEntry.IsPlotColorSet; } _treeRootNode.FromHereToLeavesDo(node => { if ((node.Tag is Altaxo.Main.ItemDefinitionLevel) && (Altaxo.Main.ItemDefinitionLevel)node.Tag == level) { node.IsExpanded = true; // expand the node the current color set belongs to (like "Builtin", "Application" etc.) } else if (node.Tag is IColorSet && object.ReferenceEquals(node.Tag, colorSet)) { node.IsSelected = true; // select the node of the current color set } }); } ; GuiTreeView.ItemsSource = _treeRootNode.Nodes; }
/// <summary> /// Updates the tree view node selection according to the currently selected item. /// </summary> protected virtual void UpdateTreeViewSelection() { var selectedItem = InternalSelectedItem; GuiTreeView.ItemsSource = null; _treeRootNode.FromHereToLeavesDo(node => { node.IsExpanded = false; node.IsSelected = false; }); // deselect and collapse all nodes if (_styleListManager.GetParentList(selectedItem) != null) { var colorSet = _styleListManager.GetParentList(selectedItem); Altaxo.Main.ItemDefinitionLevel level = Altaxo.Main.ItemDefinitionLevel.Project; _treeRootNode.FromHereToLeavesDo(node => { if ((node.Tag is Altaxo.Main.ItemDefinitionLevel) && (Altaxo.Main.ItemDefinitionLevel)node.Tag == level) { node.IsExpanded = true; // expand the node the current item list belongs to (like "Builtin", "Application" etc.) } else if (node.Tag is IColorSet && object.ReferenceEquals(node.Tag, colorSet)) { node.IsSelected = true; // select the node of the current item list } }); } ; GuiTreeView.ItemsSource = _treeRootNode.Nodes; }
public ColorSetIdentifier(Altaxo.Main.ItemDefinitionLevel colorSetLevel, string colorSetName) { if (string.IsNullOrEmpty(colorSetName)) { throw new ArgumentOutOfRangeException("colorSetName is null or is empty"); } _level = colorSetLevel; _name = colorSetName; }
public string GetLevelString(Altaxo.Main.ItemDefinitionLevel level) { switch (level) { case Altaxo.Main.ItemDefinitionLevel.Builtin: return("Builtin"); case Altaxo.Main.ItemDefinitionLevel.Application: return("App"); case Altaxo.Main.ItemDefinitionLevel.UserDefined: return("User"); case Altaxo.Main.ItemDefinitionLevel.Project: return("Project"); default: throw new NotImplementedException(); } }