Programattically Hiding a ToolWindow

Docking/MDI for WPF Forum

Posted 16 years ago by David Mullin
Version: 4.0.0457
Avatar
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 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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 16 years ago by David Mullin
Avatar
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 16 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Right, if you aren't using documents, then you'd have to set focus within your Grid instead.


Actipro Software Support

The latest build of this product (v24.1.3) was released 27 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.