Search code examples
wpfwindows-8wpf-controls

Windows 8 WPF progress bars don't have glow animation


The progress bars in Windows Forms applications have the standard "shine" animation, but when I try to add a progress bar in WPF I don't get such a thing by default. How do we get this back with WPF in Windows 8?

Windows Forms

WPF


Solution

  • It's a rather bizzare fix, but you need to enable Windows Forms styles in your application to use the "gloss." Here's how I did it.

    1. Add a reference in your project to System.Windows.Forms
    2. Go to the Project settings page and click View Application Events
    3. Add a handler to your Application.Startup using the following code (in VB.NET, C# similar) (also, if you need to include the arguments, do so)
    Class Application
    
        ' Application-level events, such as Startup, Exit, and DispatcherUnhandledException
        ' can be handled in this file.
    
        Private Sub Application_Startup() Handles Me.Startup
            System.Windows.Forms.Application.EnableVisualStyles()
        End Sub
    
    End Class
    

    It seems weird that you would have to call this in order to get the WPF progressbar to work, but the code works for me.