Posted 15 years ago
by Jon von Gillern
Version: 9.1.0503
Platform: .NET 3.5
Environment: Windows Vista (32-bit)
This took a while to figure what was causing this, but I finally got it:
If you have a TabbedMdiContainer where all of the documents have 'CanDrag="False"' the WindowActivate Event will not fire if a ToolWindow has focus. Once you give focus to the contents of the document window you can change doc windows back and forth and the event will fire. But as soon as you click another ToolWindow, the window activated event will not fire until you click on the contents of the document window.
Here is sample code:
If you set the CanDrag attribute to true, everything works as expected - the WindowsActivated Event fires regardless of what previously had focus.
[Modified at 08/16/2009 10:11 PM]
If you have a TabbedMdiContainer where all of the documents have 'CanDrag="False"' the WindowActivate Event will not fire if a ToolWindow has focus. Once you give focus to the contents of the document window you can change doc windows back and forth and the event will fire. But as soon as you click another ToolWindow, the window activated event will not fire until you click on the contents of the document window.
Here is sample code:
<DockPanel LastChildFill="True">
<docking:DockSite x:Name="MyWholeDockSite">
<docking:SplitContainer Orientation="Horizontal" >
<docking:ToolWindowContainer >
<docking:ToolWindow Title="Tool Window">
<StackPanel>
<TextBox Text="Tool Window TextBox" />
</StackPanel>
</docking:ToolWindow>
</docking:ToolWindowContainer>
<!-- Documents -->
<docking:Workspace>
<docking:DockSite x:Name="RuleDockSite"
WindowActivated="RuleDockSite_WindowActivated"
>
<docking:Workspace>
<docking:TabbedMdiHost IsCloseButtonOnTab="True" >
<docking:TabbedMdiContainer>
<docking:DocumentWindow Title="Doc1" CanDrag="False">
<TextBox Text="Doc1" />
</docking:DocumentWindow>
<docking:DocumentWindow Title="Doc2" CanDrag="False">
<TextBox Text="Doc2" />
</docking:DocumentWindow>
</docking:TabbedMdiContainer>
</docking:TabbedMdiHost>
</docking:Workspace>
</docking:DockSite>
</docking:Workspace>
</docking:SplitContainer>
</docking:DockSite>
</DockPanel>
private void RuleDockSite_WindowActivated(object sender, ActiproSoftware.Windows.Controls.Docking.DockingWindowEventArgs e)
{
Console.WriteLine("Activated " + e.Window.Title);
}
[Modified at 08/16/2009 10:11 PM]