Articles in this section
Category / Section

How to access the TabOrderIndexInDockMode of the DockWindow in DockingManager?

4 mins read

The Index of the tabbed state window can be accessed by using the InterTabControl in the DockedelementTabbedHost. The GetHost () method is used to get the DockedelementTabbedHost of the DockWindow and the TabOrderIndex from the InternalTabControl of the Host.

The following code shows how to get the index of the ActiveTabbedWindow in the DockedelementTabbedHost.

XAML

<Window x:Class="WpfDockingDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:syncfusion ="http://schemas.syncfusion.com/wpf"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
  <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <syncfusion:DockingManager Name="Docking" UseNativeFloatWindow="True">
        <ContentControl syncfusion:DockingManager.Header="Dock1" Name="Dock1" ></ContentControl>
        <ContentControl syncfusion:DockingManager.Header="Dock2" syncfusion:DockingManager.TargetNameInDockedMode="Dock3" syncfusion:DockingManager.SideInDockedMode="Tabbed" Name="Dock2" ></ContentControl>
        <ContentControl syncfusion:DockingManager.Header="Dock3" Name="Dock3" ></ContentControl>
        <ContentControl syncfusion:DockingManager.Header="Dock4" syncfusion:DockingManager.TargetNameInDockedMode="Dock3" syncfusion:DockingManager.SideInDockedMode="Tabbed" Name="Dock4" ></ContentControl>
        <ContentControl syncfusion:DockingManager.Header="Dock5" Name="Dock5" syncfusion:DockingManager.TargetNameInDockedMode="Dock3" syncfusion:DockingManager.SideInDockedMode="Tabbed"></ContentControl>
    </syncfusion:DockingManager>
    <Button Content="GetIndex of ActiveWindow" Grid.Row="1" VerticalAlignment="Bottom" Click="Button_Click"/>
    </Grid>
    </Grid>
</Window>

 

C#

namespace DockingDemo
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml.
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Docking.Loaded += new RoutedEventHandler(Docking_Loaded);
        }
        void Docking_Loaded(object sender, RoutedEventArgs e)
        {
            Docking.ActivateWindow("Dock1");
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int d = 0;
            DockedElementTabbedHost host = DockingManager.GetHost(Docking.ActiveWindow, DockingManager.GetState(Dock3));
            if (host != null && host.InternalTabControl != null)
                d = host.InternalTabControl.Items.IndexOf(Docking.ActiveWindow);         MessageBox.Show(DockingManager.GetState(Docking.ActiveWindow).ToString() + " Index of " + DockingManager.GetHeader(Docking.ActiveWindow).ToString() + " is " + d.ToString());
        }
    }   
}

 

The following screenshot displays the TabIndex of the active window.

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied