I want to make check on button click event (which Opens newWindnow).. If newWindow already opened it should close it first, and then open it.. As I can have dynamic Content for that newWindow everytime.. Here is code in Winform Application, But I need it for WPF
private void button_Click(object sender, EventArgs e)
{
using (Form fc= Application.OpenForms["newWindow"])
{
if (fc!=null){
fc.Close();
nw= new newWindow(Id, Ip, name);
}
else{
nw= new newWindow(Id, Ip, name);
}
}
nw.Show();
}
Thanks