how to detected WindowCloseEvent in other window wpf

C#
Window.Closed += Evenfunction;
Source

Also in C#: