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.
Unfortunately, activation email could not send to your email. Please try again.

Cannot set active tab no matter what i do

Thread ID:

Created:

Updated:

Platform:

Replies:

132021 Aug 8,2017 01:58 PM Aug 14,2017 07:24 AM WPF 5
loading
Tags: DockingManager
Phill Barnes
Asked On August 8, 2017 01:58 PM

Hi All

Hoping you can help.

I'm trying to add a new ContentControl to the DockingManager.Children collection and whilst it works it never sets it as the active tab.  I've tried many variations looking on the site here and it just wont set as active.  Here are a few examples.

setting SetIsSelectedTab before adding

public void AddNewTab(UserControl uc, string header)
{
            ContentControl cc = new ContentControl();
            cc.Content = uc; //my user control

            DockingManager.SetHeader(cc, header);
            DockingManager.SetState(cc, DockState.Document);
            DockingManager.SetIsSelectedTab(cc, true);

            MasterContainer.Children.Add(cc);
}

-----------------------------------
Using the ActivateWindow (I've also used ActiveWindow property and set it to the object)

public void AddNewTab(UserControl uc, string header)
{
            int hashCode = uc.GetHashCode();
            string sHashCode = hashCode >= 0 ? hashCode.ToString() : (-hashCode).ToString(); //make positive     
            ContentControl cc = new ContentControl();
            cc.Content = uc; //my user control
            cc.Name = sHashCode;

            DockingManager.SetHeader(cc, header);
            DockingManager.SetState(cc, DockState.Document);

            MasterContainer.Children.Add(cc);
            MasterContainer.ActivateWindow(sHashCode);
}

----------------------------------

No matter what the new tab is created and i can select it manually but it is never activated / focused when added.  Does anyone have any ideas please, really stuck and I'm  new to WPF so this is all a learning curve, I'm sure I'm being an idiot somewhere :(

My XAML if needed is

   <Syncfusion:DockingManager x:Name="MasterContainer" 
                                   UseDocumentContainer="true"  />


Marimuthu Sivalingam [Syncfusion]
Replied On August 9, 2017 08:00 AM

Hi Phil,

Thank you for contacting Syncfusion Support.

We have checked the reported query "No matter what the new tab is created and I can select it manually but it is never activated / focused when added" and we were unable to reproduce the reported behavior in our DockingManager control. But we have prepared the sample to meet your requirement. In this sample, we have set ActiveWindow of DockingManager as Newly added child. Please download the sample for the same from the below link.

Sample: Docking_SelectTab

Note: In our DockingManager control set’s active tab as newly created child by default.

If we have misunderstood your requirement, please provide EssentialStudio version and issue reproducible sample with replication steps. It will help to proceed further on this.

Regards,
Marimuthu S.

Phill Barnes
Replied On August 9, 2017 09:03 AM

Hi

Thank you very much for your response.  I have changed my code a little bit to help me figure out where it is going wrong.  The sample you provided is pretty much exactly how i had it and it works perfectly.  The only difference was the way in which the method was called.  Your sample was on button click.  The way i was calling this method was from a DataGrid_MouseDoubleClick event and I've discovered this is where the issue lies.

If i keep double clicking sometimes it activates the new tab, it all seems to be about timing.  Perhaps the second click is overriding focus or similar I'm really not sure.  I added a button to the grid row to run the exact same method and it works every time.  It just does not like being called (or should i say its temperamental) from the DataGrid DoubleClick event.

Do you have any suggestions on why that could be?  


Marimuthu Sivalingam [Syncfusion]
Replied On August 10, 2017 07:50 AM

Hi Phill,

Thanks for your update.

We have checked your query and we could reproduce the reported behavior. In our DockingManager, we have changed the SelectedItem while MouseDown on TabItem content. In your scenario, you have double clicked on DataGrid control, to add new DocumentTab. It triggered the MouseDown event of TabItem Content after new Document Tab was added. So, Active Document was changed from newly added Tab to last previous SelectedItem. So, this issue occurs from your side. Now, we have prepared the sample to meet your requirement. In this sample, we have handled the MouseDoubleClick Event of DataGrid to cancel the MouseDown event of TabItem content. Please download the sample for the same.

Sample:  modified_Docking_SelectTab

If, we have misunderstood your query please provide more details with your sample codes. It will help to proceed further.

Regards,
Marimuthu S.


Phill Barnes
Replied On August 11, 2017 04:20 AM

Hi,

Thank you! 

It was as simple as that, much appreciated ;)



Marimuthu Sivalingam [Syncfusion]
Replied On August 14, 2017 07:24 AM

Hi Phill,

Thank you for your update.

We are glad to know that, your reported behavior has been resolved. Please let us know if you need any further assistance, we will be happy to assist you.

Regards,
Marimuthu S.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;