Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Phone 8 Progressbar

I am making a quiz game and for this reason, whenever a question is asked i need a time based progress bar which will actually decrease. Time will be very short like 1-3 second. I need a solution, so that I can make a progressbar that will animate to zero based on time.

Thanks for your reply.

like image 516
warrior3hsan Avatar asked May 21 '26 22:05

warrior3hsan


1 Answers

You can create an animation targeting the Value property of your ProgressBar.
Let's say you have added the ProgressBar as:

<ProgressBar x:Name="progress"/>

Then add the StoryBoard in page Resources as (set the Duration based on your requirement):

<phone:PhoneApplicationPage.Resources>
    <Storyboard x:Name="sb">
        <DoubleAnimation Storyboard.TargetName="progress"
                                 Storyboard.TargetProperty="Value"
                                 From="100" To="0" Duration="0:0:3"/>
    </Storyboard>
</phone:PhoneApplicationPage.Resources>

Run the animation from code behind as:

sb.Begin();
like image 200
Abhishek Avatar answered May 30 '26 13:05

Abhishek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!