This is a migrated thread and some comments may be shown as answers.
Dynamically Add Panels
11 Answers 235 Views
This is a migrated thread and some comments may be shown as answers.
Alex Rogers
Top achievements
Rank 1
Alex Rogers asked on 14 Oct 2009, 05:55 PM
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

11 Answers, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 20 Oct 2009, 09:06 AM
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.
0
Rick Knicely
Top achievements
Rank 1
answered on 07 May 2010, 01:21 AM
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
0
Miroslav Nedyalkov
Telerik team
answered on 11 May 2010, 11:19 AM
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.
0
ITA
Top achievements
Rank 1
answered on 06 Feb 2013, 08:47 AM
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
0
Miroslav Nedyalkov
Telerik team
answered on 06 Feb 2013, 09:25 AM
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.

0
ITA
Top achievements
Rank 1
answered on 06 Feb 2013, 09:29 AM
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
0
Miroslav Nedyalkov
Telerik team
answered on 07 Feb 2013, 08:37 AM
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.

0
ITA
Top achievements
Rank 1
answered on 07 Feb 2013, 09:12 AM
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
0
Miroslav Nedyalkov
Telerik team
answered on 07 Feb 2013, 09:39 AM
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.

0
Brett
Top achievements
Rank 1
answered on 16 Sep 2013, 10:14 PM
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
0
Vladi
Telerik team
answered on 19 Sep 2013, 11:25 AM
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 >>
Asked by
Alex Rogers
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Rick Knicely
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
ITA
Top achievements
Rank 1
Brett
Top achievements
Rank 1
Vladi
Telerik team
Share this question
or