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 8216509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:09:02+00:00 2026-06-07T12:09:02+00:00

Just documenting this as a question an answer so that somebody else doesn’t have

  • 0

Just documenting this as a question an answer so that somebody else doesn’t have to suffer the same pain.

I have a WPF application that animates pages, much like swiping on an iPhone. All was good until one of the pages needed to contain a WebBrowser. It did not respond at all well to the animation – when it was supposed to slide in, it wouldn’t appear until you focused it, and when it was supposed to slide out, it would go away until you moved the mouse over it. In both cases it just popped in/out rather than animating.

Complicating matters, during the project it was decided to move back to .net 3.5 instead of 4 for unrelated reasons.

So the question is: how can I either (a) get the WebBrowser to properly animate; or (b) how can I hide the WebBrowser at the start of animation and show it again at the end. The animation is currently defined in XAML, and I don’t particularly want to change it to code.

And a follow up question is: is there a better way, still using .net 3.5?

  • 1 1 Answer
  • 0 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-06-07T12:09:04+00:00Added an answer on June 7, 2026 at 12:09 pm

    UPDATE The WPF WebBrowser is so pathetically lame compared to the WinForms one, I have swapped over, using WindowsFormsHost. Everything below still applies, but the WebBrowser is now not so nobbled (eg. it has a DocumentCompleted event).


    I pretty quickly gave up on the option to animate the WebBrowser, as it just got all too hard, and instead decided to hide and re-show it. The start of the animation is triggered by a Command on the View Model. It then finds the page that should be displayed, creates it, and kicks off the animation through an attached property that reflects the transition state.

    I created an interface, IRequireTransitionInfo, such that a call to IRequireTransitionInfo.TransitioningFrom gives it a chance to hide itself and IRequireTransitionInfo.TransitioningTo to show again. TransitioningFrom was easy, but TransitioningTo had to be called when the storyboard completed.

    Initially, in the constructor of the View Model, it went looking for the Storyboard and hooked into its Completed event, as in the code below:

        Storyboard animation = Application.Current.FindResource("SlideAnimation") as Storyboard;
        if (animation != null)
        {
          animation.Completed += new EventHandler(animation_Completed);
        }
    

    And then the event handler:

    void animation_Completed(object sender, EventArgs e)
    {
      IRequireTransitionInfo info = currentViewModel as IRequireTransitionInfo;
      if (info != null)
        info.TransitioningTo(currentView);
    }
    

    This seemed to be working pretty well with .net 4. After downgrading to .net 3.5, when the code above to hook up the Completed event ran, I got the following error:

    Specified value of type 'System.Windows.Media.Animation.Storyboard' must have IsFrozen set to false to modify.
    

    Despite some of the other answers on SO, you cannot unfreeze a frozen Freezable, and moving the code into the constructor of the MainWindow didn’t help.

    I went down the path of an attached property on the Storyboard that was bound to a command on the View Model.

    <Storyboard x:Key="SlideAnimation" local:EventCommand.StoryboardCompleted="{Binding Source={StaticResource Locator}, Path=Current.MainViewModel.StoryboardCompletedCommand}">
    

    However, this resulted in the following error at runtime:

    Cannot convert the value in attribute 'ContentTemplate' to object of type 'System.Windows.DataTemplate'. Cannot freeze this Storyboard timeline tree for use across threads.
    

    It seems you can’t do any databinding on a Storyboard (under .net 3.5 at least). Consequently, I solved the problem somewhat inelegantly by having the attached property just define the string name of a resource that was expected to implement an interface supporting notification of storyboard completion.

    <Storyboard x:Key="SlideAnimation" local:EventCommand.StoryboardCompletedHandler="Locator">
    

    If anybody knows of a better way to handle this situation under .net 3.5, I would be glad to hear.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a knowledge question which I would like to ask: For example, I have
Just a simple question, but can't get an answer on my own. In memory
I know, I know... Eric Lippert's answer to this kind of question is usually
This surely is a noob question, but I can't find an answer in Doxygen
I just spent several hours of my life debugging this problem. I'm documenting it
I have a colleague who insists that his code doesn't need comments, it's "self
Documenting this here because I just wasted an hour trying to figure this out.
Just checking my JS and I have an error, but I cannot see where.
Just learning the world of jquery, and all my googling gives examples like this:
Just see this: SELECT clientid,clientname,startdate,enddate,age FROM clients WHERE clientid IN (1,2,3,4,5) AND CASE WHEN

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.