ToolWindow contents disappear sometimes.

Docking/MDI for WPF Forum

Posted 6 years ago by Sara Buehrle
Version: 14.1.0601
Avatar

We have some tool windows where sometimes while undocking and redocking, the contents disappear from the tool window.  This does not happen all the time.  I found the topic, Document/ToolWindow DataContext is Cleared in the help and am wondering if I can use a binding for the Title of the ToolWindow or is this not possible?  This is what I have:

 <docking:ToolWindow x:Name="NavigationToolWindow"

Title="{Binding ToolWindowTitleBarHelp}"

Header="{Binding NavigationHeaderName}"

CanClose="False"

FontWeight="UltraLight" >

If I am understanding the documentation correctly, it appears that this may cause the contents to disappear when redocking?

Thanks!

Comments (7)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Sara,

I would recommend that if you do data binding, you set the DataContext directly on the ToolWindow instance.  You could even bind the ToolWindow's DataContext with something like "{Binding ElementName=window, Path=DataContext}" where "window" is your root Window.  If you do that the DataContext on the docking window will remain constant no matter where it is docked/floated.  If you don't do that, then the inherited DataContext will change as the docking window is docked/undocked around into different places.


Actipro Software Support

Posted 6 years ago by Sara Buehrle
Avatar

So I will be able to change the Title and Header of the Tool Window with a binding if I do so in the DataContext?  All of our views are UserControls, not Windows, though I assume that would work similarly?

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Yes I would think that would work.


Actipro Software Support

Posted 6 years ago by Sara Buehrle
Avatar

I do not think this is the issue.  When I remove the Bindings from the <ToolWindow> and just hardcode the values for verification purposes, the problem still occurs..the child of my <ToolWindow> is a Grid.  It is setup similar to the examples. 

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

We'd probably need you to give us something to debug if you'd like further assistance on this.  If you can't figure it out, please make a new very simple sample project that shows the problem and email that to our support address.  Rename the .zip file extension so it doesn't get spam blocked.  Thanks!


Actipro Software Support

Posted 6 years ago by Sara Buehrle
Avatar

So we have a DockSite that contains 2 SplitContainers.  The first SplitContainer contains a WorkSpace (which is working fine).  The second SplitContainer contains 2 ToolWindowContainers.  Each ToolWindowContainer contains 2 ToolWindows.  I believe that the order of the ToolWindows in the ToolWindowContainer determines which ToolWindow to place on top with the focus.  When I place our Navigator Tool Window on top, the scenario that I am currently debugging works fine.  However, when the Navigator Tool Window is NOT on top in the initial load, it does not work correctly.

Here is the scenario:

I load the view and all ToolWindows are visible.  Of course, one of each in the ToolWindowContainer is on top...I auto-hide both ToolWindowContainers and then hover over the Navigator window and choose to Dock, it docks but the content is blank.  If I load with the Navigator on top, it works fine.

I also noticed that if I simply replace the code in the Navigator Tool Window with only a textblock, this works fine with the Navigator NOT on top. 

Is there something that is loading everything for the ToolWindow that is on top that is not occurring for the ToolWindow that is NOT on top??

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

ToolWindowContainers are similar to regular native WPF TabControls in that they only are presenting the content for the selected tab.  The other unselected tool window's content is not within the visual tree.  That's the only difference.  But there shouldn't be any problems with having multiple tool windows in a container at startup. 

I suspect there is an issue in how you are setting things up but I can't really tell you unless we have something to debug per our previous reply.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.