Smooth ProgressBar in WPF

I use the ProgressBar control in a WPF application, and I get this old, Windows 3.1 ProgressBlocks thing. VB6 had the property of showing a sleek ProgressBar. Is there such a thing for WPF?

+6
c # progress-bar wpf
source share
4 answers

I could not find a direct solution for this. But I found something even better. In WPF, you can use Windows Themes. I use Windows XP and have Vista-Aero Theme in my WPF application, making all controls look like Vista-Aero.

Here is the code ...

Go to Application.xaml.vb and write ...

Enum appThemes Aero Luna LunaMettalic LunaHomestead Royale End Enum Private Sub Application_Startup(ByVal sender As Object, ByVal e As System.Windows.StartupEventArgs) Handles Me.Startup setTheme(appThemes.Aero) End Sub ''' <summary> ''' Function to set the default theme of this application ''' </summary> ''' <param name="Theme"> ''' Theme of type appThemes ''' </param> ''' <remarks></remarks> Public Sub setTheme(ByVal Theme As appThemes) Dim uri As Uri Select Case Theme Case appThemes.Aero ' Vista Aero Theme uri = New Uri("PresentationFramework.Aero;V3.0.0.0;31bf3856ad364e35;component\\themes/Aero.NormalColor.xaml", UriKind.Relative) Case appThemes.Luna ' Luna Theme uri = New Uri("PresentationFramework.Luna;V3.0.0.0;31bf3856ad364e35;component\\themes/Luna.NormalColor.xaml", UriKind.Relative) Case appThemes.LunaHomestead ' Luna Mettalic uri = New Uri("PresentationFramework.Luna;V3.0.0.0;31bf3856ad364e35;component\\themes/Luna.Metallic.xaml", UriKind.Relative) Case appThemes.LunaMettalic ' Luna Homestead uri = New Uri("PresentationFramework.Luna;V3.0.0.0;31bf3856ad364e35;component\\themes/Luna.Homestead.xaml", UriKind.Relative) Case appThemes.Royale ' Royale Theme uri = New Uri("PresentationFramework.Royale;V3.0.0.0;31bf3856ad364e35;component\\themes/Royale.NormalColor.xaml", UriKind.Relative) End Select ' Set the Theme Resources.MergedDictionaries.Add(Application.LoadComponent(uri)) End Sub 

(hope you can convert it to C #)

+2
source share

I'm not sure what you want to do. If you just need a progress bar that "shifts" from side to side, as when starting Vista, you can use: IsIndetermined = true.

If you really want to go from 0% to 100%, you need to either animate over the value, as shown in this example in msdn: http://msdn.microsoft.com/en-us/library/system.windows.controls.progressbar .aspx or set the value explicitly either in encoding (most likely from the working background), or through binding to a changing value.

However, WPF ProgressBar should always be "smooth", there is a possibility that the user interface will by default be a simpler version via the RemoteDesktop connection.

0
source share

I was recently annoyed by the appearance of my progress bars on XP after being developed on Vista. I did not want to try the suggestions that I saw for loading Vista styles from the dll, but in this article gave me what I was in search of. appearance - no new classes. In addition, it has a glass timer backlight. There are no images in this article, but it looks just like Vista ProgressBar.

0
source share

All Articles