问题
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.
Something like this would do it:
回答1:
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
来源:https://stackoverflow.com/questions/43385348/custom-wpf-progressbar-to-include-upper-limit-indicator