Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
9364
Dynamically adding new panels
posted

Application has several panels some or all of which the user may choose to have on his screen. It is very much like Visual Studio in that user may choose their own combination of panels, their layout (docking) etc. He can choose which panel to keep closed. Each open panel has one user control filling it.

When the application restarts, I want to restore the last settings i.e. the panel docking, the controls inside them. very much like Visual Studio

I am wondering :

1. how would the application know which panels were open last time and where they were placed by the user? So, panel x may have been docked to top by one user and while docked bottom by another use and a third user may have closed it completely. In other words, at app start time, I need to know which panels to open and where to dock them. I am hoping the DockManager would provide some help with that. Any samples code available? 

2. once I determine the panel that are to be opened, I would then instantiate the control and add it to the panel? Is that the approach you would recommend. I know this is not an Infragistics question per se but I am hoping there is something in the toolset that I may be able to exploit.

 Thanks!

Parents
  • 44743
    posted

    vrn said:
    1. how would the application know which panels were open last time and where they were placed by the user? So, panel x may have been docked to top by one user and while docked bottom by another use and a third user may have closed it completely. In other words, at app start time, I need to know which panels to open and where to dock them. I am hoping the DockManager would provide some help with that. Any samples code available? 

     

    The UltraDockManager has SaveAs... and LoadFrom... method which allow you to save and load layout files. This will do exactly what you ask in your first question. You would typically want to save the layout file in the FormClosed event and load it if it exists at the end of the constructor or in the Load event of the Form. The Docking Demo sample uses the layout files, but in a slightly different way. It allows you to save and load layout files from a menu. It also saves the layout when the program loads and allows the user to reset the layout by loading in the originally saved layout.

    vrn said:
    2. once I determine the panel that are to be opened, I would then instantiate the control and add it to the panel? Is that the approach you would recommend. I know this is not an Infragistics question per se but I am hoping there is something in the toolset that I may be able to exploit.

    I haven't tried using it with loading layout files yet, but there is an InitializePane event which you could use to only load a control once the pane is first shown.

Reply Children