Background:
The TabClick event was added to the C1DockingTabPage class in the 2016 v1.5 release. Due to this, customers with older licenses cannot use the TabClick event.
Customers with older license keys can use the following code to achieve similar results.
Steps to Complete:
1. Handle C1CommandDock’s ControlAdded event and inside create MouseClick event handlers for each C1DockingTab
private void C1CommandDock1_ControlAdded(object sender, ControlEventArgs e)
{
if (e.Control.GetType() == typeof(C1DockingTab))
{
var newTab = e.Control as C1DockingTab;
if (newTab.HasChildren)
{
newTab.MouseClick += c1DockingTab1_MouseClick;
}
}
}
2. Now, handle C1DockingTab’s MouseClick event and check if any C1DockingTabPage contains clicked mouse location
private void c1DockingTab1_MouseClick(object sender, MouseEventArgs e)
{
var dockTab = sender as C1DockingTab;
if (e.Button == MouseButtons.Left)
{
for (int pg = 0; pg < dockTab.TabPages.Count; pg++)
{
if (dockTab.TabPages[pg].TabBounds.Contains(e.Location) == true)
{
Debug.WriteLine($"DockingTabPage clicked: {dockTab.TabPages[pg].Name}");
}
}
}
}
Tags:
Ruchir Agarwal