/// <summary> /// Make a slice visible, either because it needs to be drawn, or because it needs to be /// focused. /// </summary> /// <param name="tci"></param> internal static void MakeSliceVisible(Slice tci) { // It intersects the screen so it needs to be visible. if (!tci.Visible) { int index = tci.IndexInContainer; // All previous slices must be "visible". Otherwise, the index of the current // slice gets changed when it becomes visible due to what is presumably a bug // in the dotnet framework. for (int i = 0; i < index; ++i) { Control ctrl = tci.ContainingDataTree.Controls[i]; if (ctrl != null && !ctrl.Visible) ctrl.Visible = true; } tci.Visible = true; Debug.Assert(tci.IndexInContainer == index, String.Format("MakeSliceVisible: slice '{0}' at index({2}) should not have changed to index ({1})." + " This can occur when making slices visible in an order different than their order in DataTree.Controls. See LT-7307.", (tci.ConfigurationNode != null && tci.ConfigurationNode.OuterXml != null ? tci.ConfigurationNode.OuterXml : "(DummySlice?)"), tci.IndexInContainer, index)); // This was moved out of the Control setter because it prematurely creates // root boxes (because it creates a window handle). The embedded control shouldn't // need an accessibility name before it is visible! if (tci.Label != null && tci.Label.Length > 0 && tci.Control != null) tci.Control.AccessibilityObject.Name = tci.Label;// + "ZZZ_Slice"; } tci.ShowSubControls(); }