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.




Through researching this issue I found that there were some events that were available for the
Storyboardclass. one of the events is theCompletedevent.By tying in information from the other posts of using
.InvalidateVisual()which forces a redraw of theWindowsFormsHost. This works for the sliding out portion of the animation. For the sliding back I just simply hid theWindowsFormsHostas it began its animation of closing. This way it would not linger out in the user space while the panel was closing.Xaml:
Code behind: