自定义 WPF ProgressBar 以包含上限指示器 [英] Custom WPF ProgressBar To Include Upper Limit Indicator

查看:165
本文介绍了自定义 WPF ProgressBar 以包含上限指示器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个具有上限属性的自定义进度条(这必须与控件的最大值不同).当您为此属性设置值时,进度条上的指定位置会出现一条简单的红线.

I would like to make a custom progress bar with upper limit property (this must be different then the maximum value of the control). When you set a value to this property a simple red line appears on the progress bar at the specified location.

这样的事情可以做到:

推荐答案

您可以在新的 ProgressBar 类中继承,将新的 DependencyProperty 添加到新的最大值.

You can Inherit From ProgressBar class in a new one, add your new DependencyProperty to it of new maximum value.

为其设置新样式和模板以显示新行:

Set a new style and template for it to show the new line:

https://wpftutorial.net/HowToCreateACustomControl.html

这篇关于自定义 WPF ProgressBar 以包含上限指示器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆