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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:42:04+00:00 2026-06-12T15:42:04+00:00

I am looking for a way to force a WindowsFormsHost control to redraw itself

  • 0

I am looking for a way to force a WindowsFormsHost control to redraw itself after an animation is finished moving it, but I am not finding a solution.

I followed an example to have a sliding panel in my WPF application by following http://bitsbobsetc.wordpress.com/2011/07/10/creating-a-sliding-panel-in-wpf/

In the example he uses only basic wpf controls. In my sliding panel the main part of it is the WindowsFormsHost. The issue I am having is the animation happens as it should, but the WindowsFormsHost does not get drawn until after the user interacts with something else. Like a refresh of the main window makes it visible.

The same sort of thing happens when the sliding panel is to be hidden. WindowsFormsHost is still shown and can be interacted with until the user interacts with something else.

From Animating WindowsFormsHost it seems like this is a known issue, but I am not overly concerned with the animation, just showing and hiding the panel.

Below are some images to help describe the current behavior.

SidePanelClosed
SidePanelOpenNotDrawn
SidePanelOpenAndDrawn
SidePanelClosedButStillDrawn

  • 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-12T15:42:05+00:00Added an answer on June 12, 2026 at 3:42 pm

    Through researching this issue I found that there were some events that were available for the Storyboard class. one of the events is the Completed event.

    By tying in information from the other posts of using .InvalidateVisual() which forces a redraw of the WindowsFormsHost. This works for the sliding out portion of the animation. For the sliding back I just simply hid the WindowsFormsHost as it began its animation of closing. This way it would not linger out in the user space while the panel was closing.

    Xaml:

    <Storyboard x:Key="expandStoryBoard" 
        TargetProperty="RenderTransform.(TranslateTransform.X)"
        AccelerationRatio=".4"
        DecelerationRatio=".4" Completed="Storyboard_Completed">
            <DoubleAnimation Storyboard.TargetName="SidePanel" Duration="0:0:0.6"
        From="0" To="250">
    </Storyboard>
    

    Code behind:

    private void Storyboard_Completed(object sender, EventArgs e)
    {
        this.InvalidateVisual();
    }
    
    private void OpenPanel()
    {
        SidePanel.BeginStoryboard((Storyboard)this.Resources["expandStoryBoard"]);
        expanded = !expanded;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First off, I am not looking for a way to force the compiler to
I am looking for a way to force the browser to download an image
I'm looking for way to write Javascript programs / scripts on desktop, not inside
First, I'm not looking a way to parse an RSS-feed. I am creating an
I'm looking for a way to force drupal to use 1.4 on specific pages.
Quick version: We're looking for a way to force a transaction to rollback when
I'm using Jetty 7.0 embedded mode and looking for a way to force Jetty
Is there a way to force a postback in code? I'm looking to force
I'm looking for a way to get text-shadow that looks like css3 text-shadow, but
I am desperately looking for a way to force (or even hack) Umbraco to

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.