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.
just try this sample
namespace FadeInAndOutWindow
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private bool closeCompleted = false;
private void FormFadeOut_Completed(object sender, EventArgs e)
{
closeCompleted = true;
this.Close();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (!closeCompleted)
{
FormFadeOut.Begin();
e.Cancel = true;
}
}
}
}