Closing the WPF MVVM Window

I am new to WPF and MVVM. I would like to minimize the window, not close it. In other words, I would like to cancel the Closingwindow event and minimize this window.

How do I do this MVVM?

If this is relevant, in the end I will install ShowInTaskbaron falseand use the WinForms tray component.

+2
source share
2 answers

A common misunderstanding with MVVM is that there can never be code in a view. This is simply not true.

MVVM , , , (, Windows), -. - ViewModel - .

ViewModel, MVVM, ViewModel ( ).

+9

:

e.Cancel = true;
this.ShowInTaskbar = false;
this.WindowState = WindowState.Minimized;
+1

All Articles