I am currently developing a wpf c# application. I have added to event triggers to the xaml of the form to fade in when the window loads and fades out when the window closes.
Unloaded is not a suitable event for this, i'm not sure if this event can even occur for windows. You need to handle Closing, prevent it from actually closing, start an animation and close it when the Completed event of the animation occurs.
e.g.
private void Window_Closing(object sender, CancelEventArgs e)
{
Closing -= Window_Closing;
e.Cancel = true;
var anim = new DoubleAnimation(0, (Duration)TimeSpan.FromSeconds(1));
anim.Completed += (s, _) => this.Close();
this.BeginAnimation(UIElement.OpacityProperty, anim);
}