简体   繁体   中英

Adding a progress bar to the background of a WPF control

How can I modify certain WPF controls (ie combobox, textbox, etc) to have a progressbar in the background of the control (which I can enable and disable on demand). I don't need it to actually show an accurate progress, rather I just need an indication that this control is waiting for something to finish. A spinning icon inside the control would be OK too.

I have seem some answers that deal with having one control on top of another and setting transparency, etc, but I would greatly prefer to find a better solution.

Thanks!

You can put anything anywhere, you just need to modify the respective Template , which may not be trivial, you could start by copying the existing ones .

To enable and disable easily you maybe should subclass the control you target so you can have a dedicated dependency property for that which can be bound to the Visibility of the ProgressBar in the template (perhaps with a BooleanToVisibilityConverter ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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