Specified element is already the logical child of another element. Disconnect it first.
Views.Home winHome = new Views.Home(); object tmpwinHome= null ; tmpwinHome= winHome.Content; winHome.Content = null; foreach (Window window in Application.Current.Windows) { if (window.GetType() == typeof(Login1)) { (window as Login1).Content = new ContentControl() { Content = tmpwinHome}; } }
Quote:If element is the child of a Panel (e.g. Grid) you have to remove it from the Panel's Children collection. If it is set as Content of a ContentControl, you'd have to set that Content to null (or anything else that is not element).
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)