如何在 WPF 中制作选取框进度条?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/638650/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 20:07:39  来源:igfitidea点击:

How do I make a marquee progress bar in WPF?

wpf.net-3.5controlsstyles

提问by Russ

In Winforms I could set the ProgressBarStyle of a progress bar to Marqee, and that would have the progress bar incriment on its own without having to be set, for processes where I don't know how long its going to take, and no good way to report back to the UI.

在 Winforms 中,我可以将进度条的 ProgressBarStyle 设置为 Marqee,这样就可以自行设置进度条,而无需设置,对于我不知道需要多长时间的进程,也没有什么好方法向 UI 报告。

I would like to do the same in WPF, but I can't find a way to pull it off short of hosting a winform progress bar, which seems counter productive.

我想在 WPF 中做同样的事情,但我找不到一种方法来实现它,而不是托管一个 winform 进度条,这似乎适得其反。

How can I pull this off in WPF? Do I have to host a winform progress bar?

我怎样才能在 WPF 中做到这一点?我必须托管一个 winform 进度条吗?

回答by Noldorin

I think you simply want to set the IsIndeterminateproperty of the ProgressBar to true. (See thisarticle, which also has a nice example of a fancy circular progress indicator.)

我认为您只是想将 ProgressBar的IsIndeterminate属性设置为true。(请参阅这篇文章,其中还有一个精美的循环进度指示器示例。)

回答by JaredPar

Try the following

尝试以下

<ProgressBar 
  IsIndeterminate="True"
  Orientation="Horizontal" />

The key is the oddly named IsIndeterminate attribute. Setting this to true means Marque

关键是奇怪命名的 IsIndeterminate 属性。将此设置为 true 意味着 Marque