Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 627693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:33:22+00:00 2026-05-13T19:33:22+00:00

All, Can someone tell me why this KeyTime is telling me it is a

  • 0

All,

Can someone tell me why this KeyTime is telling me it is a negative value at runtime? I’ve removed some logic that builds a path to an image.

public Storyboard CreateAnimationStoryBoard(DependencyObject dependencyObjectTarget,Image targetImage)
{
        try
        {



            Storyboard sb = new Storyboard();
            Storyboard.SetTarget(sb, dependencyObjectTarget);
            Storyboard.SetTargetName(sb, targetImage.Name);
            Storyboard.SetTargetProperty(sb, new PropertyPath(Image.SourceProperty));

            ObjectAnimationUsingKeyFrames oaukf = new ObjectAnimationUsingKeyFrames();

            oaukf.Duration = TimeSpan.FromSeconds(animationLength);
            oaukf.BeginTime = new TimeSpan(0, 0, 0);

            for (int i = startFrame; i <= endFrame; i++)
            {
                *build an animation string path here (hidden)*

                Uri u;

                Uri.TryCreate(animationString.ToString(), UriKind.RelativeOrAbsolute, out u);
                BitmapImage bi = new BitmapImage(u);

                DiscreteObjectKeyFrame dokf = new DiscreteObjectKeyFrame();

                dokf.KeyTime = KeyTime.Uniform;
                dokf.Value = bi;

                oaukf.KeyFrames.Add(dokf);

            }

            sb.Children.Add(oaukf);
            return sb;

        }

Now, specifically, at runtime, it tells me that “KeyTime property on KeyFrame object must be set to a non-negative TimeSpan value”. If I dive a bit deeper in the variable, I get no further debugging information. I’ve checked if the bitmaps are null, which they aren’t. I’ve tried setting my own timespan (to 1 second) for example, and I get the same error as above.

This all stems from a similar function I have in WPF that builds a storyboard in this exact manner. The only difference in the two is that the Keytime is set to KeyTime.PACED in wpf. Since Silverlight apparently doesn’t have this option, I used Uniform and have run into this error. Can someone shed some light on why this is happening in Silverlight, but works completely fine in WPF?

  • 1 1 Answer
  • 4 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:33:22+00:00Added an answer on May 13, 2026 at 7:33 pm

    Your use of the Keytime variable is a bit off:

    In setting your keyframe, say on Visibility, use this:

            DiscreteObjectKeyFrame kf = new DiscreteObjectKeyFrame();
            kf.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(1000));
            kf.Value = Visibility.Visible;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone tell me why this processes all the files and then does it
Can someone tell me why this code isn't removing the subview that's being animated?
Hi all can someone please tell me what does this line of code do
Can someone tell me how I can disable all controls within a div? The
Can someone please tell me how to show all privileges/rules from a specific user
Can someone give me a Powershell script that will change the format of all
Can someone help me with this: This is a program to find all the
can someone tell me why this works in my gedit on ubuntu def initialize
I'm new to Linq and SQL terminology - can someone tell me why this
Can someone tell me how to disable a button in Android unless all three

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.