简体   繁体   中英

wpf how to temporary remove a control from the main view and put into a new window

I have WPF application which has a main window that contains panels. I want to be able to temporary remove one panel from the main view (after button click) and put it into a new window in full screen mode, and then by Escape key clicked I want the control to go back to the original place in the main window. I don't know how to remove and save the panel position in order to restore the main view.

Any help would be appreciated!

I would simply change the visibility of the panel so that it disappears and duplicate a 2nd one in the new full screen view. That way you can just reverse the process, ie close the full screen, deleting the new copy, and make the original visible again. This way you don't have to worry about saving the position.

Assumeing you are using the mvvm pattern it is simple. create a new full screen window view , that is bound to the viewmodel of your panel. and you are done!

if you don't use mvvm. stop and learn mvvm.

I think you should use MVVM or MVP to construct you WPF Application. it's easy if you use MVVM.

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