WPF ProgressBar in VB.NET

In this article you will learn how to create ProgressBar in WPF.
  • 2557

ProgressBar: WPF progress bars are conceptually the same as Windows progress bars; however, a very noticeable difference is that using standard coding techniques, the WPF Progress Bars do not update correctly while the application is processing to implementing a progress bar display for long-running tasks is a commonly occurring task. WPF has a simple ProgressBar control which works as you would expect.

One neat trick that you can perform with the ProgressBar is using it to show a longrunning status indicator, even if you don't know how long the task will take. Interestingly (and oddly), you do this by setting the IsIndeterminate property to true:

<ProgressBar Height="18" Width="200" IsIndeterminate="True"></ProgressBar>

The WPF ProgressBar has a "SetValue" method that can be used to update the progress of the ProgressBar. However, this method will not cause the ProgresssBar to refresh when there is a tight coding loop.

Example of an ProgressBar

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
            <Grid>
            <ProgressBar Height="59" HorizontalAlignment="Left" Margin="10,10,0,0" Name="progressBar1"
            VerticalAlignment
="Top" Width="256" Value="30" />     
       
</Grid>
    </Window>

Output window


progbar.gif 

Conclusion

Hope this article help you to understand how to create ProgressBar in WPF.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.