简体   繁体   English

在WPF程序中实现标准

[英]Implementing a bar in a WPF program

I'm looking to make a WPF application that uses an illuminated bar as a "progress bar." 我正在寻找一个WPF应用程序,该应用程序将发光的栏用作“进度栏”。 Not in the traditional sense such as a program loading, but to display to the user how far he has progressed in a certain objective/task. 不是从传统意义上讲,例如程序加载,而是向用户显示他在某个目标/任务中的进度。 Below is an example of the bar I am trying to describe. 以下是我要描述的酒吧示例。

Progress Bar 进度条

I would like to make a path using multiple bars connected to each other but have no idea how to go about putting them in the program. 我想使用相互连接的多个条来建立路径,但不知道如何将它们放入程序中。 Thanks for your answers in advance! 预先感谢您的回答!

As @ORMapper correctly pointed out, the ProgressBar control is the correct way to go, using a control template to make it look however you'd like. 正如@ORMapper正确指出的那样, ProgressBar控件是正确的方法,可以使用控件模板使它看起来像您想要的那样。

Regarding your second question: if you want the value of one ProgressBar to be dependent on a value of another ProgressBar, you should modify the Maximum property to correctly show the intended value. 关于第二个问题:如果希望一个ProgressBar的值依赖于另一个ProgressBar的值,则应修改Maximum属性以正确显示预期值。

For example, if you have one Main progress bar, which should reach 100% only after 2 other tasks have been completed - give it a Maximum value of 200, then set its value by using a calculation such as: MainProgressBar.Value = firstTaskValue + secondTaskValue . 例如,如果您有一个主进度条,仅在完成其他2个任务后该进度条应达到100%-将其Maximum设置为200,然后使用如下计算来设置其值: MainProgressBar.Value = firstTaskValue + secondTaskValue
It will only reach 100% after the 2 tasks have been completed... 只有完成两个任务后,它才会达到100%...
You can play with this however you want, for instance if one task is more important then another: MainProgressBar.Value = firstTaskValue + 2 * secondTaskValue . 您可以随意使用它,例如,如果一个任务比另一个任务更重要: MainProgressBar.Value = firstTaskValue + 2 * secondTaskValue

Anyways, this is logic you'll have to implement by yourself... 无论如何,这是您必须自己实现的逻辑...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM