is there a way to handle the window close button ie "X" in the top right corner in the viewmodel by binding to a command? or overriding the window.close command so that closing one window goes back to the previous window. Thanx.
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
- How to properly change a resource dictionary
There are several methods for this. I have pointed out two methods below.
You can use attached commands to bind the close button in your view model.
You can use Below code
Xaml:
View Model
This is my RelayCommand class.
the problem was that i was closing a parent window and reopening it after closing its respective child window, causing memory leaks. I resolved by hiding the parent window and then showing it again after child window closes. I am new to wpf and windows development so i learn as i go.