Represents a control that indicates the progress of an operation.
Namespace:
System.Windows.Controls
Assembly:
System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
<TemplatePartAttribute(Name := "ProgressBarTrack", Type := GetType(FrameworkElement))> _
<TemplatePartAttribute(Name := "ProgressBarIndicator", Type := GetType(FrameworkElement))> _
<TemplateVisualStateAttribute(Name := "Determinate", GroupName := "CommonStates")> _
<TemplateVisualStateAttribute(Name := "Indeterminate", GroupName := "CommonStates")> _
Public Class ProgressBar _
Inherits RangeBase
Dim instance As ProgressBar
[TemplatePartAttribute(Name = "ProgressBarTrack", Type = typeof(FrameworkElement))]
[TemplatePartAttribute(Name = "ProgressBarIndicator", Type = typeof(FrameworkElement))]
[TemplateVisualStateAttribute(Name = "Determinate", GroupName = "CommonStates")]
[TemplateVisualStateAttribute(Name = "Indeterminate", GroupName = "CommonStates")]
public class ProgressBar : RangeBase
XAML Object Element Usage
A ProgressBar control visually indicates progress of a lengthy operation with one of two styles.
The following illustration shows a progress bar indicating continuous progress and a progress bar indicating value-based progress.
ProgressBar Control
.png)
Customizing the ProgressBar Control
To apply the same property settings to multiple ProgressBar controls, use the Style property. To change the visual structure and visual behavior of a ProgressBar, copy and modify its default style and template. For more information, see Control Customization.
If a dependency property for a ProgressBar is set by its default style, the property might change from its default value when the ProgressBar appears in the application. For more information, see Dependency Property Value Precedence. You can get the default style and template for ProgressBar from ProgressBar Styles and Templates.
The following example demonstrates a value-based ProgressBar and an indeterminate ProgressBar.
Run this sample
<StackPanel x:Name="LayoutRoot" Background="White">
<Border BorderThickness="5" BorderBrush="Black">
<StackPanel Background="LightGray">
<TextBlock HorizontalAlignment="Center" Margin="10"
Text="Value-Based Progress Bar" />
<ProgressBar x:Name="pg1" Value="100" Margin="10" Maximum="200"
Height="15" IsIndeterminate="False" />
</StackPanel>
</Border>
<Border BorderThickness="5" BorderBrush="Black">
<StackPanel Background="LightGray">
<TextBlock HorizontalAlignment="Center"
Margin="10" Text="Indeterminate Progress Bar" />
<ProgressBar x:Name="pg2" Margin="10" Height="15"
IsIndeterminate="True" />
</StackPanel>
</Border>
</StackPanel>
System..::.Object
System.Windows..::.DependencyObject
System.Windows..::.UIElement
System.Windows..::.FrameworkElement
System.Windows.Controls..::.Control
System.Windows.Controls.Primitives..::.RangeBase
System.Windows.Controls..::.ProgressBar
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference
Other Resources