Dockcontrol Save/Preserve Layout

Posted by: johan on 18 April 2018, 4:56 pm EST

    • Post Options:
    • Link

    Posted 18 April 2018, 4:56 pm EST

    I need to preserve the entire layout of all tabs (floating and non floating) within a form using the C1DockControl. As I understand (and found) there is a method for this in the WPF edition, but I am using the WinForm edition.

    If it is possible, is there any code sample that can provide guidance?

    Best regards, Johan

  • Posted 19 April 2018, 3:42 am EST

    Hi Johan,

    that’s simple: use these static methods:

    
    C1DockingTab.SaveLayout(form, layoutsource);
    
    C1DockingTab.RestoreLayout(form, layoutsource);
    
    

    “layoutsource” might be a file or a stream.

    Best regards

    Wolfgang

  • Posted 19 April 2018, 10:58 am EST

    Thanks for reply.

    However, this method simply is not there. I cant find “SaveLayout” or “RestoreLayout” on any of the objects, such as C1DockingTab class.

    I am using ComponentOne v 2018v1 and Dotnet framework 4.7 and Visual Studio 2017.

    There is some documentation on the following page

    http://helpcentral.componentone.com/nethelp/c1command

    /C1.Win.C1Command.4~C1.Win.C1Command.C1DockingTab~SaveLayout(Form,Stream).html

    On there it says compability

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    I am using Windows 10

    How can I find this function? Its very important to our application.

    Best regards,

    Johan

  • Posted 19 April 2018, 1:46 pm EST

    Same here. It s found in the “object explorer” => F2

    But not in the code windows

  • Posted 20 April 2018, 1:30 am EST

    Hello Johan and Andreas,

    I tested the behavior at my end with same environment and it seems to be available in code too. Please refer following images.

    However, I would like to reiterate, as Wolfgang mentioned, these methods are [b]static[/s] methods, so trying to access them from an instance of the class would not show its availability, in order to access them, use the class directly without using its instance.

    For details, please refer: http://help.grapecity.com/componentone/NetHelp/c1command/webframe.html#loadingandsavingthel.html

    Hope that clarifies.

    Thanks & Regards,

    Ruchir Agarwal

  • Posted 20 April 2018, 6:33 am EST

    Yes, thats right. I missed that somehow. :slight_smile:

    btw, I tried before to google “DockingTab SaveLayout”, but ended up with documentation for Silverlight and WPF. this is one reason I didnt find it myself. If I would have found the link you provided in the last post, that would have solved the problem, but I didnt see it.

    one more thing. Before Componentone had one forum/section per component (which was easier), now all posts are mixed, and using the search didnt work the way I expected.

    Thanks, Johan

  • Posted 21 April 2018, 1:36 pm EST

    One more thing

    Now I have found another issue. This is regarding what properties gets saved when using “SaveLayout”.

    Currently there seems to be only 3 properties included “Name”, “TabVisible” and “ChildIndex”, see the attached image.

    If the user changes the text (caption) of the tab, that does not get serialized.

    I would also like to have the “Tag” property included in the xml, so I can put an identifier to reference the specific tabs.

  • Posted 23 April 2018, 8:17 am EST

    Hi,

    I could observe the behavior. However, as per my understanding as the name says this method is to save settings such that the layout (not other settings) can be re-obtained. So, the properties currently serialized are enough and is correct.

    However, to confirm I am discussing the case with concerned team [ID: 318895]. I will get back to you once the information is confirmed/solution is shared.

    Thanks,

    Ruchir Agarwal

  • Posted 17 March 2020, 9:10 am EST

    Hello,

    I am happy to let you know that with the latest release 2020v1, parameters are added to the SaveLayout method to define additional C1DockingTabPage property names that you would like to store. Example: The following code will store C1DockingTabPage .Text and C1DockingTabPage.Tag properties as well.

    C1DockingTab.SaveLayout(this, “layoutProperties.xml”, “Text”, “Tag”);

    But please note that C1DockingTabPage.Tag property has ‘object’ type, so it will only stored if it has a string type value. So, you will have to think about the conversion of the Tag property himself (DesiredType->string, string->DesiredType).

    This is only true for properties of type ‘object’, other properties will be saved and restored without additional intervention from the developer side.

    Thanks,

    Ruchir

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels