Hello
I am trying to determine whether a tab is visible to the user or not. The reason for this is that we have some complex UI logic which we only want to invoke if the tab is visible. I have written a test WPF app to attempt to figure this out.
<docking:DockSite Name="DockSite"
WindowActivated="DockSite_OnWindowActivated"
WindowDeactivated="DockSite_OnWindowDeactivated"
FloatingWindowOpening="DockSite_OnFloatingWindowOpening">
<docking:Workspace>
<docking:DocumentWindow >
<docking:DockSite>
<docking:SplitContainer Orientation="Vertical">
<docking:ToolWindowContainer>
<docking:ToolWindow Title="Tab1">
<TextBlock Text="This is tab 1"
FontSize="32"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</docking:ToolWindow>
<docking:ToolWindow Title="Tab2">
<TextBlock Text="This is tab 2"
FontSize="32"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</docking:ToolWindow>
<docking:ToolWindow Title="Tab3">
<TextBlock Text="This is tab 3"
FontSize="32"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:SplitContainer>
</docking:DockSite>
</docking:DocumentWindow>
</docking:Workspace>
</docking:DockSite>
Code behind:
using System.Diagnostics;
using System.Linq;
using System.Windows;
using ActiproSoftware.Windows.Controls.Docking;
namespace DockingSpike.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void DockSite_OnWindowActivated(object sender, DockingWindowEventArgs e)
{
Debug.WriteLine($"{e.Window.Title} activated");
}
private void DockSite_OnWindowDeactivated(object sender, DockingWindowEventArgs e)
{
Debug.WriteLine($"{e.Window.Title} deactivated");
}
private void DockSite_OnFloatingWindowOpening(object sender, FloatingWindowOpeningEventArgs e)
{
Debug.WriteLine($"floating");
}
}
}
I've noticed that when a tab is floated then the other visible tab is deactivated. So this gets me half way there but not quite what I need. Is there a way to determine which tabs are visible?
[Modified 7 years ago]