Search code examples
wpfwinformspopupalertfade

Create Fading, Skinned Alert/Info Popup in WinForms (or WPF)


I am working on a WinForms application and I am wondering if there's a third-party library, or set of built-in classes, to create a fading in/out alert/info popup dialog box, much like the Bootstrap Alerts (those of course just being static; I'm interested in the look & feel). In my mind, these would appear in the lower right corner of the screen, fading in and then out after a few seconds. The alert popup would be skinned in a red color for errors, a green or blue color for notes, yellow for warnings, etc.

I'm not very familiar with graphics-related programming, so this hopefully will be an easy question for someone. Oh, and I did mention my application is WinForms but if this sort of thing is easier in WPF, I'd be willing to use that instead (I'm not very far along into the app anyway, haha).

Thank you very much for any help!


Solution

  • WPF is advanced than WinForms. I recommend using WPF.

    In WPF we can use DoubleAnimation class to create animation on UI Element Properties.

    Example: FadeIn

    DoubleAnimation showanimation=new DoubleAnimation(0, 1, timespan);
    showanimation.Completed+=showanimation_Completed;
    uielement.BeginAnimation(OpacityProperty, showanimation);
    

    Kindly checkout MSDN references: https://msdn.microsoft.com/library/ms752312(v=vs.100).aspx#thewpftimingsystem https://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimation(v=vs.110).aspx

    Other tutorial: http://www.codeproject.com/Articles/23257/Beginner-s-WPF-Animation-Tutorial

    You can check following third party libraries: http://wpffx.codeplex.com/ http://transitionals.codeplex.com/