我正在尝试在 wpf 中以编程方式创建进度条。到目前为止,这是我的代码
infoWindow = new Window();
infoWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
infoWindow.SizeToContent = SizeToContent.WidthAndHeight;
infoWindow.Title = "Please wait...";
StackPanel stackPanel = new StackPanel();
stackPanel.Orientation = Orientation.Vertical;
ProgressBar progressBar = new ProgressBar();
progressBar.IsIndeterminate = true;
progressBar.Margin = new Thickness(10,0,10,10);
progressBar.Visibility = Visibility.Visible;
progressBar.Height = 25;
progressBar.FlowDirection = FlowDirection.LeftToRight;
progressBar.Foreground = System.Windows.Media.Brushes.Green;
progressBar.Background = System.Windows.Media.Brushes.Red;
stackPanel.Children.Add(progressBar);
infoWindow.Content = stackPanel;
infoWindow.Show();
我从中得到的是一个红色的进度条。但是没有动画像我们复制文件时那样发生。(我不想显示任何进展,只是以圆形方式穿过整个条带的光)。有什么想法我在这里想念的吗?