Each RadPane provides built-in grouping functionality that allows you to place multiple panes inside a single container by organizing them in separate tab pages, similarly to the RadTabControl.
Each RadPane can be grouped along with other RadPanes inside of a single container like it is shown in the snapshot below.
Note |
|---|
In order to group your panes, you should use the Telerik.Windows.Controls.RadPaneGroup class. |
The following cases will be examined:
Grouping Panes Run-time
You can group panes during run-time by simply dragging the pane to the desired container.
Grouping Panes Programmatically
In order to group two or more panes, you should add them to the RadPaneGroup's Items collection like in the example below.
CopyXAML
<telerik:RadDocking x:Name="radDocking">
<telerik:RadSplitContainer>
<telerik:RadPaneGroup x:Name="Group1">
<telerik:RadPane x:Name="Pane1" Header="Server Explorer"/>
<telerik:RadPane x:Name="Pane2" Header="Toolbox"/>
</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</telerik:RadDocking>The same operation can be done in the code-behind. You can group panes using procedural code in two ways:
- Using the RadPaneGroup's Items collection
CopyC#
private void GroupPanes()
{
Telerik.Windows.Controls.RadPane pane3 = new Telerik.Windows.Controls.RadPane();
pane3.Header = "Properties";
Group1.Items.Add( pane3 );
}
CopyVB.NET
Private Sub GroupPanes()
Dim pane3 As New Telerik.Windows.Controls.RadPane()
pane3.Header = "Properties"
Group1.Items.Add(pane3)
End Sub- Using the AddItem exposed by the RadPaneGroup class
CopyC#
private void GroupPanes()
{
Telerik.Windows.Controls.RadPane pane3 = new Telerik.Windows.Controls.RadPane();
pane3.Header = "Properties";
Group1.AddItem( pane3, Telerik.Windows.Controls.Docking.DockPosition.Center );
}
CopyVB.NET
Private Sub GroupPanes()
Dim pane3 As New Telerik.Windows.Controls.RadPane()
pane3.Header = "Properties"
Group1.AddItem(pane3, Telerik.Windows.Controls.Docking.DockPosition.Center)
End Sub
Removing Panes Run-Time
In order to remove panes run-time you should either close the pane or remove the pane from the group via drag and drop.
Removing Panes Programmatically
You can remove panes using procedural code in two ways:
- Using the RadPaneGroup's Items collection
CopyC#
private void RemovePane( RadPane paneToRemove )
{
Group1.Items.Remove( paneToRemove );
}
CopyVB.NET
Private Sub RemovePane(RadPane paneToRemove)
Group1.Items.Remove(paneToRemove)
End Sub- Using the RemoveFromParent method of the RadPane class
CopyC#
private void RemovePane( RadPane paneToRemove )
{
paneToRemove.RemoveFromParent();
}
CopyVB.NET
Private Sub RemovePane(RadPane paneToRemove)
paneToRemove.RemoveFromParent()
End Sub
Hiding All Panes
The RadPaneGroup class exposes HideAllPanes method, which allows you to hide all visible panes belonging to the group.
CopyC#
private void HideAllPanes()
{
Group1.HideAllPanes();
}
CopyVB.NET
Private Sub HideAllPanes()
Group1.HideAllPanes()
End Sub Note |
|---|
HideAllPanes method works only when all of the objects are constructed and added to the object tree. Which means that you should invoke it after the Loaded event of the RadDocking control has been fired. |
Showing All Panes
The RadPaneGroup class exposes ShowAllPanes method, which allows you to show all hidden panes belonging to the group.
CopyC#
private void ShowAllPanes()
{
Group1.ShowAllPanes();
}
CopyVB.NET
Private Sub ShowAllPanes()
Group1.ShowAllPanes()
End Sub Note |
|---|
ShowAllPanes method works only when all of the objects are constructed and added to the object tree. Which means that you should invoke it after the Loaded event of the RadDocking control has been fired. |
Tip |
|---|
| If you need information about the events fired when showing and hiding panes, take a look at the Events topic. |
Pinning All Panes
The RadPaneGroup class exposes PinAllPanes method, which allows you to pin all panes belonging to the group.
CopyC#
private void PinAllPanes()
{
Group1.PinAllPanes();
}
CopyVB.NET
Private Sub PinAllPanes()
Group1.PinAllPanes()
End Sub Note |
|---|
PinAllPanes method works only when all of the objects are constructed and added to the object tree. Which means that you should invoke it after the Loaded event has been fired. |
Unpining All Panes
The RadPaneGroup class exposes UnpinAllPanes method, which allows you to unpin all panes belonging to the group.
CopyC#
private void UnpinAllPanes()
{
Group1.UnpinAllPanes();
}
CopyVB.NET
Private Sub UnpinAllPanes()
Group1.UnpinAllPanes()
End Sub Note |
|---|
UnpinAllPanes method works only when all of the objects are constructed and added to the object tree. Which means that you should invoke it after the Loaded event of the RadDocking control has been fired. |
Tip |
|---|
| If you need information about the events fired when pinning and unpining panes, take a look at the Events topic. |
Set Relative Size to the RadPaneGroup
The sizes of the RadPaneGroups that are not directly set in the RadDocking control, are set relatively. You can set relative size to a RadPaneGroup by setting the PropertionalStackPanel.RelativeSize attached property. By using this property you can proportionally divide the width or the hight occupied by two or more RadPaneGroups docked to the same position. For example, if you have two pane groups docked to the top, the first one should occupy 1/3 of the available width and the second - the remaining 2/3, you have to set this proportion (1:2) in their widths as it is shown in the code snippet below.
CopyXAML
<telerik:RadDocking x:Name="radDocking">
<telerik:RadSplitContainer Height="200" InitialPosition="DockedTop" Orientation="Horizontal">
<telerik:RadPaneGroup telerik:ProportionalStackPanel.RelativeSize="200, 200">
<telerik:RadPane Header="pane" />
</telerik:RadPaneGroup>
<telerik:RadPaneGroup telerik:ProportionalStackPanel.RelativeSize="400, 200">
<telerik:RadPane Header="pane" />
</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</telerik:RadDocking>Here is the result. As you can see, the first pane group occupies 1/3 of the available width, while the second occupies the rest 2/3. The height specified is ignored because the groups have the same height as the RadSplitContainer in which they are hosted.
Other Properties and Methods Exposed by the RadPaneGroup class
- IsInDocumentHost - read-only boolean property. Returns whether the current RadPaneGroup is placed in DocumentHost.
- IsInToolWindow - read-only boolean property. Returns whether the current RadPaneGroup is in Tool Window.
- IsPaneHeaderVisible - read-only boolean property. Returns whether the pane's header is visible.
- SelectedPane - returns the currently selected pane within the group.
- EnumeratePanes() - returns IEnumeratble of RadPane objects. These are all the panes that currently belonging to the group.
Styling the RadPaneGroup
See Also