Cannot assign dock and sizeRatio properties to SplitterPanel at runtime

Posted by: sunnyl on 10 May 2019, 11:02 am EST

    • Post Options:
    • Link

    Posted 10 May 2019, 11:02 am EST

    Hi,

    I was trying to create controls to add to DashboardLayout at runtime. I assigned dock and sizeRatio properties to the splitterpanel and seems like it didn’t work because I had two splitterpanels docked to top and one docked to right. I saved the dock value to a file then reload it when the program was opened but all the splitterpanels got docked to the top. Pleas help me. Thank you!

  • Posted 10 May 2019, 12:21 pm EST

    [UPDATE]

    So I tried printing out the dock properties of three splitterpanels (two docked to top and one docked to right) and their dock properties were correct which means two tops and one right. However, if the properties were correct then two splitterpanels would be on the left and one would be on the right but they all were on top of each other. Is there another property I should manipulate beside dock?

  • Posted 13 May 2019, 6:08 am EST

    Hello,

    I think that you are setting the Dock property of the last splitter panel to Right which is why you are not getting the layout as desired. I would like to let you know that the last visible panel (C1SplitterPanel) that is added to the Split Layout( i.e C1SplitContainer) is a special case. It always behaves as if its Dock property is set to Fill (all four sides of the control are resized to match the containing control’s edges). Values of the following properties are ignored for the last visible panel: Collapsible, ResizeWhileDragging, Dock, SizeRatio, KeepRelativeSize, and Resizable. Also, an attempt to change the Width or the Height property of such a panel has no visible effect. This information is mentioned here:

    https://help.grapecity.com/componentone/NetHelp/C1SplitContainer/webframe.html#splitcontainerlayout1.html

    So in order to have a split layout containing two Splitter panels docked to top and one docked to right, instead of setting the Dock property to Right for the last panel set the Dock property to Right for the first panel. This will causes the panel to align itself with the right edges of its parent control. For the second panel set the Dock property to Top. This will cause the second panel to align itself with the top edges of its parent control. There is no need of setting the Dock property for the last panel as it will now automatically behave as if its Dock property is set to Fill and thereby result in a layout where two splitter panels would be on the left and one would be on the right.

    The code below depicts the same:

    c1SplitterPanel1.Dock = PanelDockStyle.Right; //Docks the splitter panel to the right
    c1SplitterPanel2.Dock = PanelDockStyle.Top; //Docks the splitter panel to the top
    

    Also find attached a sample(‘Dock_SplitterPanel.zip’) demonstrating the same. Dock_SplitterPanel.zip

    Please let us know in case you have any other queries.

  • Posted 13 May 2019, 9:52 am EST

    Thank you so much for your reply. I think my situation is a little complicated. I used C1DashboardLayout to allow user to make their own layout for the program so if they have three C1SplitterPanel in a C1SplitterContainer, the first panel is docked to top, second is docked to top and third is docked to right then when I reload the layout the user saves, the third panel (the final panel) will have to be docked to the right. I’m wondering if there are any other ways to do this. I don’t think I could use SaveLayout and LoadLayout of C1DashboardLayout because I would save the layout, close the program, reopen it then load the layout and according to my understanding, SaveLayout and LoadLayout don’t work that way.

  • Posted 15 May 2019, 12:14 am EST

    Hello,

    Unfortunately we are not able to completely understand the issue you are facing. We would request you to provide us some more information to help us assist you further.

    Kindly let us know about the following pointers:

    1. Which Layout type(Split/Grid/Flow) are you currently using ?
    2. Are you adding the C1SplitContainer with docked splitter panels as a control to one of the child containers in the Dashboard Layout control ?
    3. Or you are using a Split layout and adding the docked splitter panels to the split layout ?
    4. Could you please explain how are you saving and loading the layout again on reopening the application.

    It would be really helpful if you could share a demo sample depicting the issue you are facing. This would help us get a better understanding of your use case and assist you accordingly.

Need extra support?

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

Learn More

Forum Channels