i'm trying develop progressbar
fills accordingly value manually set it. example, have progressbar
:
<progressbar height="33" horizontalalignment="left" name="progressbar1" verticalalignment="top" width="285" />
i have button increases progressbar
value in 10 units each time press it, this:
private void button1_click(object sender, routedeventargs e) { progressbar1.value += 10; }
i want animate value change each time click on it. tried this:
duration duration = new duration(timespan.fromseconds(1)); doubleanimation doubleanimation = new doubleanimation(200.0, duration); progressbar1.beginanimation(progressbar.valueproperty, doubleanimation);
but goes 0 100 value of progressbar
. how can tell animation stop on specific value, instead of going 100%?
you animating value
final value of 200 if th following:
doubleanimation doubleanimation = new doubleanimation(200.0, duration);
instead change first argument value want animate to. event handler should so:
private void button1_click(object sender, routedeventargs e) { duration duration = new duration(timespan.fromseconds(1)); doubleanimation doubleanimation = new doubleanimation(progressbar1.value + 10, duration); progressbar1.beginanimation(progressbar.valueproperty, doubleanimation); }
Comments
Post a Comment