Question

Programattically Hiding a ToolWindow

Posted 6 years ago by Avatar David Mullin
I've got a ToolWindow inside of an AutoHideLeftContainer. This ToolWindow contains a list control - when an item in the grid is selected, I update the contents of the client area of the window. What happens, however, is that once I click in the list, the ToolWindow no longer auto-hides. I _think_ this has something to do with the list is getting and holding on to focus, and the ToolWindow is thus not hiding.

What I've done to work around this is the following:
this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (DispatcherOperationCallback)delegate
{
    Page.MoveFocusFirstField();
    return null;
}, null);
I find this solution less than ideal, however. Is there some way to say to the ToolWindow "hide yourself right now!"?

David Mullin

Comments (3)

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

That is correct, it is standard behavior for when an auto-hide tool window contains focus, it remains open. You need to move focus outside of the tool window to get it to close. One thing you could do is call:
dockSite.ActivatePrimaryDocument();

That will activate the primary document that is open, thus moving focus out of the auto-hide tool window.

Actipro Software Support
Posted 6 years ago by David Mullin
Calling dockSite.ActivePrimaryDocument() has absolutely no effect. Perhaps this is because I don't have a "document"?
<Grid Grid.Row="1" >
    <docking:DockSite x:Name="docSite" Background="Transparent" CanToolWindowsClose="False" ToolWindowsHaveOptions="False">
        <docking:DockSite.AutoHideLeftContainers>
            <docking:ToolWindowContainer docking:DockSite.ControlSize="500, 500">
                <docking:ToolWindow Title="Selection List" MinWidth="800" x:Name="SelectionWindow">
                    <ctConfigControls:SideListGrid x:Name="SideList" />
                </docking:ToolWindow>
            </docking:ToolWindowContainer>
        </docking:DockSite.AutoHideLeftContainers>
        
        <docking:SplitContainer>
            <docking:Workspace Background="Transparent">
                <Grid Name="ContentGrid" />
            </docking:Workspace>
        </docking:SplitContainer>
    </docking:DockSite>
</Grid>
The Page control ends up getting added as a child to ContentGrid during screen creation.
Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Right, if you aren't using documents, then you'd have to set focus within your Grid instead.

Actipro Software Support
Information The latest build of this product (2014.2 build 0611) was released 4 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.