I have a Button
that closes my window when it\'s clicked:
Very clean and MVVM way is to use InteractionTrigger
and CallMethodAction
defined in Microsoft.Interactivity.Core
You will need to add a new namespace as below
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
You will need the Microsoft.Xmal.Behaviours.Wpf assembly and then the below xaml code will work.
You don't need any code behind or anything else and can also call any other method of Window
.