Setting the docking position programatically

7 posts, 1 answers
  1. Oscar
    Oscar avatar
    4 posts
    Member since:
    Aug 2011

    Posted 29 Aug 2011 Link to this post

    Dear Telerik Team,

    I wanted to dock a RadPaneGroup programmaticaly from splitContainer1 to splitContainer2.
    From your documentation I understood that I had to:

    splitContainer1.Items.Remove(group);
    splitContainer2.Items.Add(group);

    But now I want to set the docking position in splitContainer2 but, since SplitterPosition is read only, can you tell me how to do this?

    Thanks!
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 31 Aug 2011 Link to this post

    Hi Oscar,

     To dock a group or a pane to a specific position you may use the AddItem method of the SplitContainer. In order for it to work you must first remove the group from its old position (like you do in your code) and after that call this method of the other split container. Please note that the splitContainer2 must be already placed in the visual tree of the Docking control in order for this method to work.

    Hope this helps.

    Greetings,
    Miroslav Nedyalkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
  4. Oscar
    Oscar avatar
    4 posts
    Member since:
    Aug 2011

    Posted 31 Aug 2011 Link to this post

    Hi Miroslav and thank you for your reply.

    Yes, I understood how I can move a pane or group from one split container to the other.
    My question was how can I specify where it docks after I insert it into the target split container, as is done with the InitialPosition of the split container on XAML:http://www.telerik.com/help/silverlight/raddocking-managing-docking-controls-dynamically.html#Docking_a_Pane_Design-Time

    Thanks!
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 02 Sep 2011 Link to this post

    Hello Oscar, 

    The InitialPosition property takes effect only if the SplitContainer is placed directly inside the Docking control. If I understand you correctly you need to place a group in a SplitContainer. Here you have these options:
    • Just add the group to the other container (as you suggested)
    • Add the group at a specified index in the container (again using the Items collection)
    • Add the group using the compass logic by calling the AddItem method, which allows you to specify where to Dock the group
    If none of these suggestions help, please explain us in more details what you need to achieve. Some screen shots would be of great help.

    Best wishes,
    Miroslav Nedyalkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Oscar
    Oscar avatar
    4 posts
    Member since:
    Aug 2011

    Posted 02 Sep 2011 Link to this post

    Check the attached picture please.

    Imagine that I just added programmatically the "Server Explorer" Group to the split container.
    How can I specify if the Server Explorer is DockedTop, DockedRight or DockedBottom?

    Can you give me more information about the compass method?

    Thanks!
  7. Answer
    Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 07 Sep 2011 Link to this post

    Hi Oscar,

     I took a look at the picture and it looks like it doesn't represent how the Docking control behaves. On the first picture (under which is written DockedTop) the SplitContainer is docked to the left, on the second one (DockedRight) the container is docked to the Top and the last one (DockedBottom) the container is docked to the right. Please let me know if I misunderstood the picture.

    The AddItem method (which uses the compass logic) could be used to place a pane or a group or a SplitContainer relatively to a SplitContainer or Group which is already contained in a SplitContainer which is in the Docking control. The parameter is the relative position to which the new item will be added. Left means that it will placed at the left side of the target, Right - to the right and etc., exactly the same as you drop the dragged item to the respective compass item.

    Hope this information is helpful.

    Best wishes,
    Miroslav Nedyalkov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  8. Oscar
    Oscar avatar
    4 posts
    Member since:
    Aug 2011

    Posted 08 Sep 2011 Link to this post

    Hi Miroslav,

    Yes, the printscreen wasn't very correct, I copied the images from your documentation but the titles were the ones below the pictures which correspond to next topic in the article.

    I finally found the AddItem method and yes it does exactly what I wanted!

    Thank you very much!
Back to Top
DevCraft banner