Frequently Used Methods
Frequently Used Methods
Frequently Used Methods
Frequently Used Methods
/// <summary> /// 把某一个元素从逻辑树中移除,使用另一个新的元素在原来的位置中替换它。 /// </summary> /// <param name="oldElement"></param> /// <param name="newElement"></param> public static void ReplaceInParent(this FrameworkElement oldElement, FrameworkElement newElement) { oldElement.RemoveFromParent(false); SetLastParent(newElement, GetLastParent(oldElement)); SetLastIndexInParent(newElement, GetLastIndexInParent(oldElement)); newElement.AttachToLastParent(); }