We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

set focus to a DockingManager children

Hi folks,

I use this code to open tabs in a DockingManager. It works well for opening new tabs, but does not set focus to an existing opened tab. The code goes to item.Focus() but tab is not shown. What I am doing wrong? Cheers

private void AddTab(DockState ds, object content, string title, string name)
{
for (var i = 0; i < dockingManager.Children.Count; i++)
{
var item = dockingManager.Children[i] as ContentControl;

if (item.Name == name)
{
item.Focus();
return;
}
}

var control = new ContentControl();
control.Name = name;
control.Content = content;
DockingManager.SetHeader(control, title);
DockingManager.SetState(control, ds);
dockingManager.Children.Add(control);
}


3 Replies

DR Durga Rajan Syncfusion Team September 1, 2017 10:42 AM UTC

Hi Josep,

Thanks for contacting Syncfusion support.

We have checked your code example and found that you're manually setting the focus. Instead of that, we suggest you to set the child as ActiveWindow to gain focus. Please download the sample for the same from below location,

Sample link:
https://www.syncfusion.com/downloads/support/directtrac/general/ze/DockingManager_Focus_Issue_resolved-1101592449.zip 
 
If the issue persists, please provide more details and modify the above sample to replicate the issue. This would help us to provide the solution at the earliest.

Regards,
Durga S.  



JO Josep September 1, 2017 10:52 AM UTC

Thanks. It works!



DR Durga Rajan Syncfusion Team September 4, 2017 10:02 AM UTC

Hi Josep,

We are glad to know that your issue has been solved. Please let us know if you need any further assistance.

Regards,
Durga S.

Loader.
Live Chat Icon For mobile
Up arrow icon