This is a migrated thread and some comments may be shown as answers.
Animate IsIndeterminate
2 Answers 27 Views
This is a migrated thread and some comments may be shown as answers.
Stephane
Top achievements
Rank 1
Stephane asked on 09 Dec 2010, 02:10 PM
Hello,

I can't animate IsIndeterminate property on a RadProgressBar. I have a custom control with a ProgressBar in it. The custom control has severals VisualState and I want to change the IsIndeterminate property according to the state of the control.

Here is my code :
<VisualState x:Name="InProgress">
                                        <Storyboard>
                                            <DoubleAnimation To="1" Duration="0:0:0.5" Storyboard.TargetName="progressbar_Status" Storyboard.TargetProperty="(UIElement.Opacity)"></DoubleAnimation>
                                            <DoubleAnimation To="1" Duration="0:0:1" Storyboard.TargetName="label_StatusMessage" Storyboard.TargetProperty="(UIElement.Opacity)"></DoubleAnimation>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="progressbar_Status" Storyboard.TargetProperty="(RadProgressBar.IsIndeterminate)" BeginTime="0:0:0">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="True" />
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
<VisualState x:Name="InProgress">
                                        <Storyboard>
                                            <DoubleAnimation To="1" Duration="0:0:0.5" Storyboard.TargetName="progressbar_Status" Storyboard.TargetProperty="(UIElement.Opacity)"></DoubleAnimation>
                                            <DoubleAnimation To="1" Duration="0:0:1" Storyboard.TargetName="label_StatusMessage" Storyboard.TargetProperty="(UIElement.Opacity)"></DoubleAnimation>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="progressbar_Status" Storyboard.TargetProperty="(RadProgressBar.IsIndeterminate)" BeginTime="0:0:0">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="True" />
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>

<VisualState x:Name="InProgress">
                                        <Storyboard>
                                            <DoubleAnimation To="1" Duration="0:0:0.5" Storyboard.TargetName="progressbar_Status" Storyboard.TargetProperty="(UIElement.Opacity)"></DoubleAnimation>
                                            <DoubleAnimation To="1" Duration="0:0:1" Storyboard.TargetName="label_StatusMessage" Storyboard.TargetProperty="(UIElement.Opacity)"></DoubleAnimation>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="progressbar_Status" Storyboard.TargetProperty="(RadProgressBar.IsIndeterminate)" BeginTime="0:0:0">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="True" />
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
<VisualState x:Name="InProgress">
                                        <Storyboard>
                                            <DoubleAnimation To="1" Duration="0:0:0.5" Storyboard.TargetName="progressbar_Status" Storyboard.TargetProperty="(UIElement.Opacity)"></DoubleAnimation>
                                            <DoubleAnimation To="1" Duration="0:0:1" Storyboard.TargetName="label_StatusMessage" Storyboard.TargetProperty="(UIElement.Opacity)"></DoubleAnimation>
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="progressbar_Status" Storyboard.TargetProperty="(RadProgressBar.IsIndeterminate)" BeginTime="0:0:0">
                                                <DiscreteObjectKeyFrame KeyTime="0:0:2" Value="True" />
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
<VisualState x:Name="InProgress">
  <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="progressbar_Status" Storyboard.TargetProperty="(RadProgressBar.IsIndeterminate)" BeginTime="0:0:0">
      <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="True" />
    </ObjectAnimationUsingKeyFrames>
  </Storyboard>
</VisualState>

I have tried with "TargetProperty="IsIndeterminate", but doesn't working neither. Can you help me ?

Thanks

2 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 09 Dec 2010, 03:18 PM
Hello Stephane,

You can try the following:

<Grid x:Name="LayoutRoot" Background="White">
    <VisualStateManager.VisualStateGroups>
        <VisualStateGroup x:Name="CommonStates">
            <VisualState x:Name="InProgress">
                <Storyboard>
                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="progressBar1"
                            Storyboard.TargetProperty="IsIndeterminate">
                        <DiscreteObjectKeyFrame KeyTime="0">
                            <DiscreteObjectKeyFrame.Value>
                                <System:Boolean>True</System:Boolean>
                            </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>
                </Storyboard>
            </VisualState>
        </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <StackPanel Width="200" HorizontalAlignment="Center" VerticalAlignment="Center">
        <telerik:RadProgressBar x:Name="progressBar1" Height="30" />
        <Button Content="Go To Indeterminate" Click="Button_Click" />
    </StackPanel>
</Grid>

private void Button_Click(object sender, RoutedEventArgs e)
{
    VisualStateManager.GoToState(this, "InProgress", false);
}

Let me know if it helps.

Kind regards,
Kiril Stanoev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Stephane
Top achievements
Rank 1
answered on 09 Dec 2010, 03:59 PM
Thank you, it works.
Asked by
Stephane
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Stephane
Top achievements
Rank 1
Share this question
or