简体   繁体   中英

Reset WPF window to its original state(startup) with a press of a button

I have a 'New' Button which creates a new file. On the press of 'New' button i want to reset a wpf to its original state like it was started first time. All the control should be in there start position.All the variable should be reinitialized. Consider it like a closing an application and again restarting it but, i don't want close the application. How can i achieve this in WPF?

Window win = new Window();

win.ShowDialog();

Try this by replacing your window name to 'Window'. Do this inside your button click event.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM