BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi,
I am using a DockingManager in MDI mode. When adding child document windows, they appear behind the other child document windows and I cannot bring them programmatically in front, no matter what I try.
While if the documents are floating it is just inconvenient, as the user has to activate the newly created window with a mouse click, if the documents are maximized, the newly created windows are hidden behind the other windows and the user does not perceive the addition of the new window at all.
So, what I've tried so far is:
- setting the focus of the DockItem's content element - e.g., newDockItem.Content.SetFocus();
- setting the ActiveWindow of DockingManager - dockingManager.ActiveWindow = newDockItem .Content;
- calling the ActivateWindow of DockingManager - dockingManager.ActivateWindow(newDockItem.Header);
Neither of these methods work.
I have found in the forum this thread:
set focus to a DockingManager children | WPF Forums | Syncfusion
It contains a sample (DockingManagerSample_132420), and that sample really works, yet the DockingManager in the sample is in TDI mode. If you change the mode of DockingManager in the same sample to MDi, all new windows are created behind the other, that are already available.
Could you, please, help?
Best regards,
Alexander
Hi again,
OK, don't bother, I found the problem.
The items I add were UserControls and I was adding them to the DockingManager.ItemsSource collection wrapped in a DockItem (in the DockItem.Content property). In that case, it is NOT possible to activate the newly added item programatically, as previously described.
If I add the UserControls directly to the DockingManager.Children collection, though, they are focusable also programatically.
Hi Alexander Tashkov,
We are glad to know that your issue has been fixed.
However, your requirement can also be achieved while using ItemSource by ActivateWindow method. Please refer to the sample for your reference.
CodeSnippets
private void Button_Click(object
sender, RoutedEventArgs e)
{
DockCollections.Add(new DockItem() { Header="NewItemHeader",State=DockState.Document,Name="NewItemName"});
Dockingmanager.ActivateWindow("NewItemName");
}
Regards
Raghavendra S
Attachment: DockingManager_(5)_f154c052.zip