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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Close button doesn't work in DocumentContainer

Thread ID:

Created:

Updated:

Platform:

Replies:

149595 Dec 2,2019 06:55 PM UTC Dec 4,2019 11:27 AM UTC WPF 2
loading
Tags: DocumentContainer
José António
Asked On December 2, 2019 06:55 PM UTC

Hi, 
I am starting to use DocumentContainer, but I have some difficulty getting it to work:

<!-- In XAML Code -->
<syncfusion:DocumentContainer 
            x:Name="_MainDockManager" 
            Mode="TDI"
            Grid.Row="1">
</syncfusion:DocumentContainer>


//Code behind
public FrameworkElement ExistDocumentInDocumentContainer(string name_) {      foreach (FrameworkElement element in _MainDockManager.Items) { if (name_.ToLower() == element.Name) { return element; }      }      return null; }   


private void ButtonTest_Click(object sender, RoutedEventArgs e) {
     string title = "HeaderTitle";
     var doc = ExistDocumentInDocumentContainer(title)
     if (doc == null)
     {
           doc = new myUserControl();
           DocumentContainer.SetHeader(doc, title);      doc.Name = title.ToLower();
_MainDockManager.Items.Add(doc);       
     }
     else
     {
          _MainDockManager.ActiveDocument = doc_;
     }
}
  
What I want to achieve is to check if the document already exists in the DocumentContainer.
If exists, then activate it else add a new obejct to the DocumentContainer.
Everything seemed to work, but whenever I close the document in the x button in the right top corner of the DocumentContainer, it stays in the DocumentContainer items list and i can´t active it or show it.

What am I doing wrong, is it the right approach?
Thanks


Niranjan Kumar Gopalan [Syncfusion]
Replied On December 3, 2019 12:51 PM UTC

Hi José António, 
 
Thanks for contacting Syncfusion support. 
 
We are analyzing your query regarding the “When close the document in DocumentContainer the items list is not updated” and we will update your regarding this query on 5th December 2019. 
 
Regards, 
Niranjan Kumar. 


Niranjan Kumar Gopalan [Syncfusion]
Replied On December 4, 2019 11:27 AM UTC

Hi José António, 
 
We have analyzed your query regarding “When close the document in DocumentContainer the items list is not updated”.  By default when tab item is closed tab item is hidden. Please use ‘RestoreDocument’ method, to restore and activate the closed document, as shown in following code example. 
 
C#: 
private void Button_Click(object sender, RoutedEventArgs e) 
        { 
            string title = "HeaderTitle"; 
            var doc = ExistDocumentInDocumentContainer(title); 
             if (doc == null) 
            { 
                doc = new myUserControl(); 
                DocumentContainer.SetHeader(doc, title); 
                doc.Name = title.ToLower(); 
                _MainDockManager.Items.Add(doc); 
 
            } 
            else 
            { 
                _MainDockManager.RestoreDocument(doc as UIElement); 
            } 
        } 
 
 
Regards, 
Niranjan Kumar 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon