Example #1
0
		private void InstallSlice(Slice slice, int index)
		{
			Debug.Assert(index >= 0 && index <= Controls.Count);

			slice.SuspendLayout();
			slice.Install(this);
			ForceSliceIndex(slice, index);
			Debug.Assert(slice.IndexInContainer == index,
				String.Format("InstallSlice: slice '{0}' at index({1}) should have been inserted in index({2}).",
				(slice.ConfigurationNode != null && slice.ConfigurationNode.OuterXml != null ? slice.ConfigurationNode.OuterXml : "(DummySlice?)"),
				slice.IndexInContainer, index));

			// Note that it is absolutely vital to do this AFTER adding the slice to the data tree.
			// Otherwise, the tooltip appears behind the form and is usually never seen.
			SetToolTip(slice);

			slice.ResumeLayout();
			// Make sure it isn't added twice.
			SplitContainer sc = slice.SplitCont;
			sc.SplitterMoved -= new SplitterEventHandler(slice_SplitterMoved);
			sc.SplitterMoved += new SplitterEventHandler(slice_SplitterMoved);
		}