show usercontrol as tab in docking manager on command

Hi,

I need help regarding your control DockingManager, i am delevelping an mvvm based wpf application.

I have on the MainWindow menu bar which contains 3 items:

  1. Customers
  2. Employees
  3. Reports

And below the menu bar i have DockingManager.

And i have 3 user controls

  1. CustomersView
  2. EmployeesView
  3. ReportsView

Now i want to click on Customers menu item and show CustomersView(usercontrol) in DockingManager as tab and same with Employees menu item adds new tab in DockingManager and shows EmployeesView(usercontrol) and same with the Reports.

If the CustomerView(usercontrol) is already opened as tab in DockingManager and the user clicks again on the Customers(menuitem) it shouldn't open another CustomersView(usercontrol) but select the already opened CustomerView(usercontrol) tab and bring it in focus.

Any sample project that does the same thing will be a great help.

Thank you




6 Replies 1 reply marked as answer

FA fahad March 15, 2022 11:49 AM UTC

Anyone please?



DR Durga Rajan Syncfusion Team March 15, 2022 10:11 PM UTC

Hi fahad,


We suggest you to active the existing child item using ActivateWindow method of DockingManager, child item’s name should be the argument of the method. Please find the sample for the same.


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/DockingManager_1736041083577162.zip


If we have misunderstood your query please provide more details about your requirement or sample to check this further.


Regards,

Durga



FA fahad replied to Durga Rajan March 16, 2022 01:05 PM UTC

Thanksfor the reply,
It works like i wanted, but i dont just want to Add empty DockPanel, i need to show a usercontrol instead.

Howdo i change the following code, so that when i click Customers(menuitem)CustomersView(usercontrol) shows instead of empty DockItem.


if(!childExist)
{
DockItem dockItem =newDockItem();
dockItem.Name= obj.ToString();
dockItem.Header= obj.ToString();
dockItem.State=DockState.Document;
DockCollections.Add(dockItem);



SN Sudharsan Narayanan Syncfusion Team March 17, 2022 12:20 PM UTC

Hi fahad,

You can be able to achieve the “DockItem should content the UserControl” requirement by using content property for the DockItem and assign the UserControl to the state. It will be done by using the Content of the document window. We have prepared the sample to achieve the requirement, please find the sample below,

Sample: https://www.syncfusion.com/downloads/support/forum/173604/ze/DockingManager_173604-1923567120

Please check the sample and let us know your concerns. We are happy to assist you.

Regards,
Sudharsan


Marked as answer

FA fahad replied to Sudharsan Narayanan March 19, 2022 03:42 PM UTC

Exactly what i needed,

Thanks.



SN Sudharsan Narayanan Syncfusion Team March 21, 2022 06:50 AM UTC

Hi Fahad,

We are glad to know that your issue has been fixed. Please let us know if you need any other assistance. We are happy to assist you.

Regards,
Sudharsan


Loader.
Up arrow icon