Activate an AutoHide window from a floating document window

Docking/MDI for WPF Forum

Posted 6 years ago by Valéry Sablonnière - Staubli
Version: 15.1.0623
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

Hi,

I have an issue when the focus is in a floating  document window, if I call the Activate method of an auto-hide tool window, the tool window is not activated.

Here is the code to reproduce it:

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking" x:Class="ActivationIssue.MainWindow"
        Title="MainWindow" Height="350" Width="525">

    <docking:DockSite CanDocumentWindowsRaft="True"
			UseHostedAutoHidePopups="False" UseHostedDockGuides="False" UseHostedRaftingWindows="False" IsLiveSplittingEnabled="False">
        <docking:SplitContainer>
            <docking:Workspace>
                <docking:TabbedMdiHost docking:Workspace.MdiTypeKey="{x:Type docking:TabbedMdiHost}">
                    <docking:TabbedMdiContainer>
                        <docking:DocumentWindow x:Name="DocumentWindow1" Title="My Document">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto" />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <TextBox />
                                <Button Grid.Row="1" Content="Activate ToolWindow" Click="ButtonBase_OnClick" />
                            </Grid>
                        </docking:DocumentWindow>
                    </docking:TabbedMdiContainer>
                </docking:TabbedMdiHost>
            </docking:Workspace>
            <docking:ToolWindowContainer RenderTransformOrigin="0.5,0.5">
                <docking:ToolWindow x:Name="ToolWindow1"  Title="Tool Window 1">
                    <TreeView x:Name="TreeView" />
                </docking:ToolWindow>
            </docking:ToolWindowContainer>
        </docking:SplitContainer>
    </docking:DockSite>

</Window>  

 code-behind:

using System.Windows;

namespace ActivationIssue
{
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();
            DocumentWindow1.Float();
            ToolWindow1.AutoHide();
        }

        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            ToolWindow1.Activate(true);
        }
    }
}

 Click on the button and... nothing happens !!

Sometimes even if you click on the ToolWindow tiotle bar, the tool window is not opened.

Best regards,

Comments (2)

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

Hello,

We have this working in vNext but in the meantime, please use this workaround:

private void ButtonBase_OnClick(object sender, RoutedEventArgs e) {
	var window = Window.GetWindow(ToolWindow1);
	if ((window != null) && (!window.IsActive))
		window.Activate();

	ToolWindow1.Activate(true);
}


Actipro Software Support

Posted 6 years ago by Valéry Sablonnière - Staubli
Avatar

Thank you for your workaround, it works !!

The latest build of this product (v21.1.2) was released 16 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.