Dynamically Add Panels

12 posts, 0 answers
  1. Alex Rogers
    Alex Rogers avatar
    13 posts
    Member since:
    Jun 2006

    Posted 14 Oct 2009 Link to this post

    Is there a way to dynamically add panels to the dock control for WPF?  I know in the winforms conrols you can use 

    RadDock1.DockControl but I have not seen any samples or documentation for this feature.  I have also looked at the Silverlight documentation and there is nothing there either.

    Alex

  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 20 Oct 2009 Link to this post

    Hello Alex Rogers,

    RadDocking can only contain RadSplitContainers. RadSplitContainers consist of RadPaneGroup. You can put RadPane in the RadPaneGroup. Check the code posted bellow:

    RadPane radPane = new RadPane() { Title = "title", Header = "header" };
    RadPaneGroup radPaneGroup = new RadPaneGroup();
    RadSplitContainer radSplitContainer = new RadSplitContainer() { InitialPosition = DockState.DockedLeft  };
     
    radPaneGroup.Items.Add(radPaneGroup);
    radSplitContainer.Items.Add(radPaneGroup);
    dock.Items.Add(radSplitContainer);

    Sincerely yours,
    Kaloyan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Rick Knicely
    Rick Knicely avatar
    43 posts
    Member since:
    Apr 2010

    Posted 06 May 2010 Link to this post

    Hello,
    I am using this technique to add panes to my RadDocking control.  I am having two issues.

    One, Sometimes the header does not show up on the pane that has been added the dock container.

    Two, is there a way to show a scroll bar when you have filled up the dock area with panes?

    Thank you,
    Rick
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 11 May 2010 Link to this post

    Hi Rick,

     About the first issue - could you please send us a sample project that reproduces the problem. This would help us investigating what the problem is.

    About the second one - you can show a scroll arrows (not a whole scrollbar) when there are too many panes by setting the ScrollViewer.HorizontalScrollBarVisibility attached property to the RadPaneGroup to Auto.

    Hope this helps!

    All the best,
    Miroslav Nedyalkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 06 Feb 2013 Link to this post

    Hi,

    this is great, but how do i add a Usercontrol to the new "RadPane" and load a special Style for this new RadPane?

    Thanks
    best regards
    rene
  7. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 06 Feb 2013 Link to this post

    Hello Rene,

    To add a UserControl to the RadPane you just need to set its content to this user control.

    I'm not quite sure how would you like to load your style, but you can set it to the pane like this:
    var pane = new RadPane { Content = new MyUserControl(), Style = myStyle }

    If your style is loaded in the App.xaml file, you can load it like this:
    var myStyle = Application.Current.Resources["MyStyleKey"] as Style;

    Hope this helps.

    Kind regards,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 06 Feb 2013 Link to this post

    Hi,

    thanks this is perfect. Ok after i added my new RadPane i want to save the Layout. This is no problem, but the new added RadPane
    is not saved with the Usercontrol inside, it's blank. How do i save the Layout with all its Content?

    thanks
    best Regrads
    rene
  9. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 07 Feb 2013 Link to this post

    Hi Rene,

    As the RadDocking control doesn't serialize the actual UI, but just its logical structure, it doesn't save the content of the panes. It handles automatically the case when panes are placed in XAML- they just need to have a SerializationTag set. However this technique cannot be used with the dynamically added panes. For them you need to hook-up to the ElementLoading event of the RadDocking control and create the dynamic pane there. To be easier for you to recognize your panes I would advise you to set SerializationTag to your dynamic panes, too.

    For more information about Docking control Save/Load layout, please refer to this article.

    Greetings,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  10. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 07 Feb 2013 Link to this post

    Hi,

    thanks so much, one more question. this is how i create a RadPane:
    InputBox dialog = new InputBox();
                    dialog.ShowDialog();
                    if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
                    {
                        string panename_s = dialog.RRR.Text;                   
                        RadPane radPane = new RadPane() { Title = panename_s, Name = panename_s};
                       
                        RadPaneGroup radPaneGroup = new RadPaneGroup();
                        RadSplitContainer radSplitContainer = new RadSplitContainer() { InitialPosition = DockState.FloatingDockable };
     
                        Controls.LayoutData MyControl = new Controls.LayoutData();
                        MyControl.Tag = panename_s;
                        radPane.Content = MyControl;
     
                        radPaneGroup.Items.Add(radPane);
                        radSplitContainer.Items.Add(radPaneGroup);
                        Docking.Items.Add(radSplitContainer);
                    }

    How do i set the "SerializationTag" for the new Pane? And how do i find this Pane again?

    thanks
    best REgards
    REne
  11. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 07 Feb 2013 Link to this post

    Hello,

    To set the SerializationTag attached property to the newly created pane you need to call the SetSerializationTag static method of the RadDocking class like this:
    RadDocking.SetSerializationTag(radPane, panename_s);

    To identify which pane is that, I would recommend you to set the SerializationTag to some string that uniquely identifies the content of this pane (like the panename_s you use for the Name of the pane).

    When loading the pane I suggest you to create a new pane, and recreate its content - trying to find it might be impossible and depends on your application logic.

    Hope this helps.

    All the best,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  12. Brett
    Brett avatar
    3 posts
    Member since:
    Aug 2013

    Posted 16 Sep 2013 Link to this post

    How could one add dynamic RadPanes via MVVM?  I attempted to place an itemscontrol within RadPaneGroup; however, I receive a reflection exception.  I am trying to dynamically add multiple RadPanes, each with a CartesianChart with a dynamic amount of LineSeries on it. 
    <telerik:RadDocking Margin="2" Padding="2" Name="radDockingPlots" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Background="Transparent" Foreground="Black">  
    <telerik:RadDocking.DocumentHost>
     <telerik:RadSplitContainer Name="PlotsSplitContainer">
      <telerik:RadPaneGroup>
       <ItemsControl ItemsSource="{Binding TagPlotManage.UserSavedPlotMaterial}" >
        <ItemsControl.ItemTemplate>
         <DataTemplate>
          <telerik:RadPane Header="{Binding plotName}">
           <telerik:RadCartesianChart Name="dynamicChart" TrackBallLineStyle="{StaticResource  trackBallLineStyle}" TrackBallInfoStyle="{StaticResource trackBallOutputInfoStyle}">
            <telerik:RadCartesianChart.Grid>
             <telerik:CartesianChartGrid MajorLinesVisibility="XY" />
            </telerik:RadCartesianChart.Grid>
            <telerik:RadCartesianChart.Behaviors>
             <telerik:ChartTrackBallBehavior ShowIntersectionPoints="False" SnapMode="None" ShowTrackInfo="True" TrackInfoUpdated="ChartTrackBallBehavior_TrackInfoUpdated" />
            </telerik:RadCartesianChart.Behaviors>                                                   
            <telerik:RadCartesianChart.HorizontalAxis>
              <telerikChartView:DateTimeContinuousAxis LabelFormat="HH:mm" MajorStepUnit="Minute" MajorStep="5"  LabelFitMode="MultiLine" Title="Time" />
            </telerik:RadCartesianChart.HorizontalAxis>
            <telerik:RadCartesianChart.VerticalAxis>
              <telerik:LinearAxis Title="{Binding}" Minimum="0" />
            </telerik:RadCartesianChart.VerticalAxis>
            <telerik:RadCartesianChart.SeriesProvider>
              <telerik:ChartSeriesProvider Source="{Binding tagCollection}">
                <telerik:ChartSeriesProvider.SeriesDescriptors>
                  <telerik:CategoricalSeriesDescriptor ItemsSourcePath="tagResultData" ValuePath="Value" CategoryPath="Timestamp" >
                    <telerik:CategoricalSeriesDescriptor.Style>
                       <Style TargetType="telerik:LineSeries">
                                                                                          
                        </Style>
                     </telerik:CategoricalSeriesDescriptor.Style>
                    </telerik:CategoricalSeriesDescriptor>
                   </telerik:ChartSeriesProvider.SeriesDescriptors>
                  </telerik:ChartSeriesProvider>
                 </telerik:RadCartesianChart.SeriesProvider>
                </telerik:RadCartesianChart>
               </telerik:RadPane>
              </DataTemplate>
             </ItemsControl.ItemTemplate>
            </ItemsControl>
          </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
      </telerik:RadDocking.DocumentHost>
    </telerik:RadDocking>

    Am I on the right track with an itemscontrol for RadPaneGroup?

    In advance, thank you for time.
    Brett
  13. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 19 Sep 2013 Link to this post

    Hi,

    In the current version of RadDocking the ItemsSource property is not supported, you can read this help article that lists the not supported properties in the control.

    In order to achieve the desired behavior in the control you could make us of a custom attached property. This blog post describes a possible approach on how to create an attached property in order to binding a collection of Panes to a specific PaneGroup. Hope this is helpful.

    Regards,
    Vladi
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready