Text on a ProgressBar in WPF

前端 未结 7 1176
日久生厌
日久生厌 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条回答
  •  猫巷女王i
    2021-02-01 12:54

    Both of the prior responses (creating a new CustomControl or an Adorner) are better practices, but if you just want quick and dirty (or to understand visually how to do it) then this code would work:

      
       
       
          My Text
       
    
    

    Just keep in mind that the z-index is such that the last item listed will be on top.

    Also, if you don't have Kaxaml yet, be sure to pick it up - it is great for playing with XAML when you're trying to figure things out.

提交回复
热议问题