/// <summary> /// Adds the child with a specified z-index. /// </summary> /// <param name="child">Child.</param> /// <param name="z">The z coordinate.</param> public virtual void AddChild(IDraw child, int z) { Debug.Assert(child != null); if (child.Parent == null) { if (Content != null) { child.Load(this, GetGraphics()); } child.Z = z; int index = Children.FindLastIndex(c => child.Z > c.Z); if (index == -1) { index = Children.FindLastIndex(c => child.Z == c.Z); } ++index; Children.Insert(Children.Count == 0 ? 0 : index, child); } else { throw new Exception("The IDraw is already in a container"); } }
/// <summary> /// Adds the child with a specified z-index. /// </summary> /// <param name="child">Child.</param> /// <param name="z">The z coordinate.</param> public virtual void AddChild(IDraw child, int z) { Debug.Assert(child != null); if(child.Parent == null) { if (Content != null) { child.Load(this, GetGraphics()); } child.Z=z; int index = Children.FindLastIndex(c => child.Z > c.Z); if(index == -1) { index = Children.FindLastIndex(c => child.Z == c.Z); } ++index; Children.Insert(Children.Count == 0 ? 0 : index, child); } else throw new Exception("The IDraw is already in a container"); }