Dynamically add and remove particular Pane/PaneGroup?

2 posts, 0 answers
  1. Dmitry
    Dmitry avatar
    20 posts
    Member since:
    Apr 2011

    Posted 05 Jul 2014 Link to this post

    I have RadDocking control with one split container and 4 RadPaneGroups each with single Pane in it. I need to implement possibility to hide and add third and fourth panes. I have done that via 
    This is working until user rearranges pane groups. After that both these calls do nothing even if PaneGroup is moved back to its initial location (at least visually). Is there a way to avoid this thing and be able to remove and add PaneGroup after user rearranged them?

    Thanks in advance.
  2. Polya
    Polya avatar
    191 posts

    Posted 07 Jul 2014 Link to this post

    Hi Dmitry,

    When we reorder RadPaneGroups in a RadSplitContainer the following actions are performed:
    1) A new RadPaneGroup is created and the Items(RadPanes) of the original RadPaneGroup are placed inside the new one.
    2) The new RadPaneGroup is placed in a ToolWindow.
    3) The original RadPaneGroup is removed from the Items Collection of the RadSplitContainer.
    4) When placing/docking the ToolWindow inside the SplitContainer, again, a new RadPaneGroup is created and the Items of the ToolWindow RadPaneGroup are placed inside the new RadPaneGroup.
    5) The ToolWindow is closed.

    Based on that, after a reorder of a RadPaneGroup the RadSplitContainer contains a copy of that group and not the original, so this line SplitContainer.Items.Remove(MyPaneGroup3); won't remove anything because MyPaneGroup3 is no longer in the Items of the SplitContainer.

    I suggest, for example, modifying the remove logic to exclude RadPaneGroups based on information of their child RadPanes. This way we will not relate on a concrete instance of a RadPaneGroup(that will be lost when reordering it), but on its content ( which will be the same ). Here is a code snippet that removes the first RadPaneGroup from the SplitContainer that has a RadPane with header "Pane Group 3":

    IEnumerable<RadPaneGroup> realPanes = this.SplitContainer.Items.OfType<RadPaneGroup>().Where(pg => pg.EnumeratePanes().Any(p => p.Header.ToString().Equals("Pane Group 3")));
    if (realPanes.Any())

    Hopefully this helps and is applicable for your scenario.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
  3. DevCraft banner
Back to Top