Retain Pane Size

With the official Q2 2015 release version of UI for WPF, RadDocking introduced a brand new feature which provides the ability to easily retain the size of the Panes.

Using the RetainPaneSizeMode property you could choose between the following three modes that provide different behaviours for retaining the size:

  • None – this is the default value of the property and uses the default behaviour of RadDocking.

  • Floating – retains the last floating size of all Panes.

  • DockingAndFloating – when a RadPane instance is floated it will keep its current docked size, while when it is being docked it will keep the size of its floating state (the ToolWindow's size). This mode provides a behaviour similar to the one observed in Microsoft's Visual Studio IDE.

The following snippets show how the RetainPaneSizeMode property could be set in XAML and in code behind:

<telerik:RadDocking x:Name="radDocking" RetainPaneSizeMode="Floating"> 
    ... 
</telerik:RadDocking> 

this.radDocking.RetainPaneSizeMode = RetainSizeMode.Floating; 

None

If the RetainPaneSizeMode is set to None and the Pane or Panes has set FloatingSize that size will always be preserved when the Pane becomes floating.

If a whole PaneGroup (with multiple panes inside) is floated the FloatingSize of the currently SelectedPane of the PaneGroup will be used.

<telerik:RadPane telerik:RadDocking.FloatingSize="200 200"> 
    ... 
</telerik:RadPane> 
Figure 1: __ Floating Pane with a set __FloatingSize: Silverlight RadDocking Floating Pane with a set __FloatingSize__:

__Figure 2: __ The Pane is docked: Silverlight RadDocking The Pane is docked:

Figure 3: __ The pane retains its __FloatingSize when it becomes floating again: Silverlight RadDocking The pane retains its __FloatingSize__ when it becomes floating again:

Please, notice that in this mode if there is a set FloatingSize to RadPane only that size will be considered and kept when the Pane becomes floating.

Floating

If the RetainPaneSizeMode is set to Floating the last floating size of each Pane will be always preserved.

In scenarios where the Pane has FloatingSize initially set that size will be applied only with the first undocking. Afterwards if the user changes the size of the Pane and docks it again the last floating size will be used when undocked again.

If Panes with different sizes are docked in same PaneGroup and the group is made floating, the size the PaneGroup will receive is the last floating size of the current SelectedPane of the group.

When there are several Panes docked in same ToolWindow the size they will take when we drag them out is the size of that ToolWindow.

__Figure 1: __ The floating Pane is resized: Silverlight RadDocking The floating Pane is resized:

__Figure 2: __ The Pane is docked: Silverlight RadDocking The Pane is docked:

__Figure 3: __ The last floating size is kept when the Pane becomes floating again: Silverlight RadDocking The last floating size is kept when the Pane becomes floating again:

We recommend setting FloatingSize only to the Pane when initial size needs to be applied. Please, notice that this size will be appplied just once when the Pane is undocked for the first time.

DockingAndFloating

If you’re looking for a behavior similar to the one observed in Microsoft's Visual Studio IDE the third mode named DockingAndFloating provides such behavior.

When RetainPaneSizeMode is set to DockingAndFloating if a Pane or PaneGroup is undocked the size that will be kept is the current docked size. On the other hand if the Pane or PaneGroup is being docked the current ToolWindow size will be kept if possible:

  • If the Pane/PaneGroup is docked left or right the Width of the ToolWindow will be kept unless the ToolWindow has Width larger than the half of the Docking’s Width. If so the half of the Docking’s Width will be taken. Please, notice that if the Docking has DocumentHost there will be same space preserved for it.

  • If the Pane/PaneGroup is docked top or bottom the Height of the ToolWindow will be kept unless the ToolWindow has a Height larger that the half of the Docking’s Height. If so the half of the Docking’s Height will be taken. Again, please notice that if the Docking has DocumentHost there will be some space preserved for it.

__Figure 1: __ The Pane is docked: Silverlight RadDocking The Pane is docked:

__Figure 2: __ The last docked size is preserved when the Pane becomes floating: Silverlight RadDocking The last docked size is preserved when the Pane becomes floating:

Find a runnable project that demonstrates all described above modes in the online SDK repository.

See Also

In this article