Dynamically change numbers of myUserConrols under paneGroup and pane

2 posts, 0 answers
  1. shay
    shay avatar
    15 posts
    Member since:
    Jun 2015

    Posted 03 Jul Link to this post

    Hi, 
    I am using the structure below to get a pane that under it there is myUserControl1
                              
    The UI will look like this:
     _______________
    | my                        |
    | UserContol1         |
    |_______________|

    The code:

    <telerik:RadSplitContainer x:Name="myContainer">
        <telerik:RadPaneGroup x:Name="myPaneGroup">
            <telerik:RadPane  Header="pane 1" >
                <MyUserConrol myUserControl1="test test" />
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>

    The issue:
    I have a button that should change Dynamically the number of my userControl - for 

    example 4 userComtrols .i want to get this. (each userControl should be set under the same structure code that was describe before)

    ________________
    | UC1      |  UC2     |              4 user controls
    |_______|_______|
    | UC3      |     UC4  |
    |_______|_______|

    code: (should be Dynamically )

    <telerik:RadSplitContainer x:Name="myContainer1">
        <telerik:RadPaneGroup x:Name="myPaneGroup1">
            <telerik:RadPane  Header="pane 1" >
                <MyUserConrol myUserControl1="test test" />
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>

    <telerik:RadSplitContainer x:Name="myContainer2">
        <telerik:RadPaneGroup x:Name="myPaneGroup2">
            <telerik:RadPane  Header="pane 2" >
                <MyUserConrol myUserControl2="test test" />
            </telerik:RadPane>
        </telerik:RadPaneGroup>
    </telerik:RadSplitContainer>

     

    and the same for 3 and 4..

    for example 2 userComtrols) 
    ________________
    | UC1       |     UC2  | 
    |               |              |
    |               |              |
    |____ ___|_______|

    what is the best way to achieve it?

    thanks

  2. Nasko
    Admin
    Nasko avatar
    585 posts

    Posted 06 Jul Link to this post

    Hello Shay,

    By design in the current version of RadDocking achieving any layout is possible via a static XAML, dynamically via the code behind or with the a MVVM friendly approach of using the PanesSource and a DockingPanesFactory features.

    So, basically for adding Panes dynamically you could either add them in code behind or use the MVVM approach with PanesSource - both will be suitable for your scenarion. On the following link you could find a sample project from our SDK Repository that demonstrates how PanesSource could be used in order to add dynamically Panes:
    https://github.com/telerik/xaml-sdk/tree/master/Docking/NestedDockingWithPanesSource

    We hope this will help you.


    Regards,
    Nasko
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top