Text on a ProgressBar in WPF

前端 未结 7 1248
日久生厌
日久生厌 2021-02-01 12:09

This may be a no-brainer for the WPF cognoscenti, but I\'d like to know if there\'s a simple way to put text on the WPF ProgressBar. To me, an empty progress bar looks naked. Th

7条回答
  •  渐次进展
    2021-02-01 12:51

    You could use an Adorner to display text over top of it.

    See MSDN article on Adorners

    You would create a class that inherits from the Adorner class. Override the OnRender method to draw the text that you want. If you want you could create a dependency property for your custom Adorner that contains the text that you want to display. Then use the example in the link I mentioned to add this Adorner to your progress bar's adorner layer.

提交回复
热议问题