views:

399

answers:

1

Is it possible in WPF to embed a ProgressBar in the Background of a TextBox?

+6  A: 

Yes, but there are varying levels of integration you could achieve.

The simplest way would be to host a ProgressBar and TextBox with see-through background in the same Grid:

<Grid>
    <ProgressBar/>
    <TextBox Background="#00ffffff"/>
</Grid>

Importantly, the background color is transparent but visible to hit testing. #00000000 would not work as expected because clicking on the TextBox would actually be clicking on the ProgressBar.

You could also retemplate the TextBox to incorporate the ProgressBar more intrinsically into its template. However, this would be of limited use unless you wrote your own control while you're at it.

HTH, Kent

Kent Boogaart
+1, You could use the color Transparent as well.
sixlettervariables