views:

17

answers:

1

I have a INotifyPropertyChanged derived class with a Volume property (float, 0.0f - 1.0f) that gets set on a fixed frequency (say 30fps). I'd like to draw a tiny volumebar displaying this in my window. I don't want to use a normal databound progressbar, I'd prefer something simpler (and faster :)).

Is there a proper way to simply draw a filled rectangle where the width is bound to my Volume property ?

+1  A: 

You could use a rectangle and a scale transform. I doubt it would be significantly faster than re-templating a ProgressBar though.

    <Rectangle Width="200" Height="40" Fill="Orange">
        <Rectangle.RenderTransform>
            <ScaleTransform ScaleX="{Binding Volume}" />
        </Rectangle.RenderTransform>
    </Rectangle>
Kris
Thanks for the response.I finally went with a very simple retemplated progressbar with the idea that if performance would ever become a problem, it would show up in a profiling session.I need to learn to stop worrying about petty stuff and just get on with the big picture ;)
Led