I have a Button that closes my window when it\'s clicked:
Button
Ok
In your current window xaml.cs file, call the below code:
xaml.cs
var curWnd = Window.GetWindow(this); // passing current window context curWnd?.Close();
This should do the thing. It worked for me, hope will do the same for you )