/// <summary> /// (Re-)Creates the splitters. /// </summary> /// <returns> /// <see langword="true"/> if splitters have changed; otherwise, <see langword="false"/>. /// </returns> private bool CreateSplitters() { var splitterPanel = SplitterPanel; if (splitterPanel == null) { return(false); } var orientation = Orientation; int numberOfSplitters = Math.Max(0, Children.Count - 1); if (orientation == _splitterOrientation && numberOfSplitters == splitterPanel.Children.Count) { return(false); } // Remove existing splitters. splitterPanel.Children.Clear(); // Create new splitters. _splitterOrientation = orientation; for (int i = 0; i < numberOfSplitters; i++) { var splitter = new DockPaneSplitter(this, i); if (orientation == Orientation.Horizontal) { splitter.HorizontalAlignment = HorizontalAlignment.Left; splitter.Width = SplitterSize; splitter.Height = double.NaN; splitter.Cursor = Cursors.SizeWE; } else { splitter.VerticalAlignment = VerticalAlignment.Top; splitter.Width = double.NaN; splitter.Height = SplitterSize; splitter.Cursor = Cursors.SizeNS; } splitterPanel.Children.Add(splitter); } return(true); }
/// <summary> /// (Re-)Creates the splitters. /// </summary> /// <returns> /// <see langword="true"/> if splitters have changed; otherwise, <see langword="false"/>. /// </returns> private bool CreateSplitters() { var splitterPanel = SplitterPanel; if (splitterPanel == null) return false; var orientation = Orientation; int numberOfSplitters = Math.Max(0, Children.Count - 1); if (orientation == _splitterOrientation && numberOfSplitters == splitterPanel.Children.Count) return false; // Remove existing splitters. splitterPanel.Children.Clear(); // Create new splitters. _splitterOrientation = orientation; for (int i = 0; i < numberOfSplitters; i++) { var splitter = new DockPaneSplitter(this, i); if (orientation == Orientation.Horizontal) { splitter.HorizontalAlignment = HorizontalAlignment.Left; splitter.Width = SplitterSize; splitter.Height = double.NaN; splitter.Cursor = Cursors.SizeWE; } else { splitter.VerticalAlignment = VerticalAlignment.Top; splitter.Width = double.NaN; splitter.Height = SplitterSize; splitter.Cursor = Cursors.SizeNS; } splitterPanel.Children.Add(splitter); } return true; }