Animate IsIndeterminate

3 posts, 0 answers
  1. Stephane
    Stephane avatar
    4 posts
    Member since:
    Sep 2010

    Posted 09 Dec 2010 Link to this post

    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. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1512 posts

    Posted 09 Dec 2010 Link to this post

    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
  3. DevCraft banner
  4. Stephane
    Stephane avatar
    4 posts
    Member since:
    Sep 2010

    Posted 09 Dec 2010 Link to this post

    Thank you, it works.
Back to Top