This project is read-only.

UserControl Disappearing when docked

Dec 18, 2008 at 11:23 PM
I am having a problem with UserControls disappearing when my DockableContent Control is docked anywhere in the app.  I am using the Managed Add-In Framework to load assemblies at runtime that contain UserControls to be added.  My DockableContent control contains a StackPanel where add these loaded UserControls.  When the DockableContent is set to Auto-Hide or is Floating all is well and everything appears but once it is docked all the UserControls disappear.  Any Ideas?
Dec 19, 2008 at 6:44 AM
Do you pass the UI that you add to the StackPanel through the serializable pipeline of the Add-In framework as well? We use exactly the same behavior as you and I have written a small handler that communicates between the container (in the host application) and the add-in (which actually holds the instance of the user interface). The reason we developed the custom handler (or helper), is that you won't receive any OnClose events (and thus can never prevent the window from being closed from within your user interface in the add-in side) because it is being serialized as FrameworkElement, not as DockableContent.
Dec 19, 2008 at 4:04 PM
I do pass the UI for the UserControl through the pipeline.  It sounds like we do it a bit differently as the StackPanel already exists on the DockableContent and all UserControls are added to that single StackPanel.  In other view modes (AutoHide, Floating) the UserControls are visible but Dock the DockableContent and then they disappear. 
Dec 19, 2008 at 4:08 PM
We have exactly the opposite problem. When floating in Aero style, we don't see anything. We also use a stackpanel that hosts our control (FrameworkElement).
Dec 19, 2008 at 5:09 PM
Strange, my prototype app I am working on displays the behavior I describe while a test solution doesn't display this behavior?!  You say your problem is with the Aero Style?
Dec 19, 2008 at 5:44 PM
Yes, we have the problem with the aero style. But I am sure it is something with the style because the demo project of AvalonDock shows exactly the same behavior. Set the theme to Aero and you will notice that as soon as you make a window float, the controls become invisible (I will have to take a look at the templates soon).

What style are you using?
Dec 19, 2008 at 8:25 PM
Ok I seem to be able to figure out why it does this.  If the AllowsTransparency property is set to True for the window then it will exhibit this behavior.  I am new to WPF so this property obviously does not do what I expected it to!