ProgressBar控件指示长时间运行任务的进度,与slider控件不同,ProgressBar控件不能与用户交互。如果不确定程序要运行多长时间,可以把IsIndeterminate设置true
<Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <ProgressBar Height="20" IsIndeterminate="True"></ProgressBar> </Grid> </Window>