Posted 13 September 2023, 4:48 pm EST
Hi Rambabu,
As per our understanding, you want to fetch the C1DockTabControl associated with the last clicked C1DockTabItem. It should not be dependent on whether the selection is changed or not.
In order to achieve the desired requirement, you can handle C1DockTabControl’s GotFocus event. Please refer to the following code snippet for the same:
private void DockWindow_GotFocus(object sender, RoutedEventArgs e)
{
var ele = sender as C1DockTabControl;
if (ele != null)
{
var focussedEle = ele.InputHitTest(Mouse.GetPosition(ele));
if (focussedEle.GetType() == typeof(Border) && ((Border)focussedEle).TemplatedParent.GetType() == typeof(C1TabItemBorder))
{
_activeWin = ele;
}
else if (focussedEle.GetType() == typeof(TextBlock) && ((TextBlock)focussedEle).TemplatedParent.GetType() == typeof(ContentPresenter))
{
var parentEle = ((TextBlock)focussedEle).TemplatedParent as ContentPresenter;
if (parentEle.TemplatedParent.GetType() == typeof(C1DockTabItem))
{
_activeWin = ele;
}
}
}
}
Kindly refer to the attached sample for full implementation. (See LastFocusedTab_Mod.zip)
Thanks & Regards,
Aastha