6 Answers, 1 is accepted
Could you describe what you want to achieve in details? The DocumentHost is arranged in the RadDocking layout according to all other SplitContainers in the RadDocking control.
I will be glad to assist you further.
George
the Telerik team
again :)
As you already know, the floating panes are getting me a headache...
Sometimes, in my application I am changing the RadDocking component visibility to Collapsed, in order to switch between the application modes. Now, if some of my RadPanes are floating their visibility does not change to Collapsed in the same time with their RadDocking parent, but they remain visible - which is not the desired behavior for me (they all should get Collapsed or Visible no mater the floating state).
Now I am thinking about a workaround, before making my RadDocking Collapsed I want to check if there are floating RadPanes and to dock them in a default position so they will all disappear with their parent.
Anyway this looks like a bug for me, maybe I should open an issue about that.
What is your opinion on this?
Best regards!
Roxana
Thank you for getting back to me.
First of all, let me explain something about the RadDocking control, its structure and how does it works. It will shed some light.
The RadDocking control arranges its components via DocumentHost, RadSplitContainers, RadPaneGroups, RadPanes, RadDocumentPane and ToolWindows. However, I suggest you refer to our online documentation, if you haven't yet, where everything is explained in details.
RadPanes are placed in the RadPaneGroups and they represents only the small TabItems (you can refer to the attached picture for details). When a RadPane is selected, its content is shown in the RadPaneGroup that contains this RadPane. RadPaneGroups are placed in RadSplitContainer.
When you drag(make floating) a pane, this pane goes out from the group. A new ToolWindow is generated, a brand new RadSplitContainer and RadPaneGroup are generated also.They go into this ToolWindow and the pane goes into this brand new RadPaneGroup. This means that the pane goes out of the RadDocking layout. When you make RadDocking collapsed, it doesn't affect the pane because it is not placed in the RadDocking control anymore.
To collapsed the ToolWindows with the RadDocking, I suggest you to handled PaneStateChange event of RadDocking.Then you can find the ToolWindows that contains the floating panes in the event handler and keep a list of their reference. Once you have a list with the ToolWindows, you can collapse them (set their Visibility property to Collapsed) in the same moment that you collapse the docking control.
Here is the code to get the ToolWindow using this PaneStageChange event handler:
private void RadDocking_PaneStateChange(objectsender, Telerik.Windows.RadRoutedEventArgs e)
{
RadPane pane = e.Source asRadPane;
if
(pane !=
null
&& pane.IsFloating)
{
ToolWindow toolWindow = pane.ParentOfType<ToolWindow>();
if
(toolWindow ==
null
)
{
toolWindow = (((pane.Parent asRadPaneGroup).Parent asRadSplitContainer).Parent) asToolWindow;
if
(toolWindow !=
null
)
{
// you got the toolWindow
}
}
else
{
// you got the toolWindow
}
}
}
Note, that there is a bug in the framework when you make RadPane floating via the ContextMenu - ParentOfType<ToolWindow> returns null in these circumstances. That's why you could get the ToolWindow using the Parent property.
I hope this helps! Please do not hesitate to contact us if you require any further information. I am glad to assist you further.
Regards,
George
the Telerik team
Updating:
The code I gave you in the previous post is for Silverlight version of RadDocking, here is the code for WPF version of RadDocking:
private
void
dock_PaneStateChange(
object
sender, Telerik.Windows.RadRoutedEventArgs e)
{
RadDocking dock = e.Source
as
RadDocking;
List<RadPane> list = dock.Panes.Where(p => p.IsFloating).ToList();
if
(dock !=
null
&& list.Count > 0)
{
foreach
(var item
in
list)
{
ToolWindow toolWindow = item.ParentOfType<ToolWindow>();
if
(toolWindow ==
null
)
{
toolWindow = (((item.Parent
as
RadPaneGroup).Parent
as
RadSplitContainer).Parent)
as
ToolWindow;
if
(toolWindow !=
null
)
{
// you got the toolWindow
}
}
else
{
// you got the toolWindow
}
}
}
}
Sorry for the mistake.
Greetings,
George
the Telerik team
I knew this things about RadDocking, as I already read the documentation, but for me it makes more sense for the ToolWindow to be bound with the RadDocking control by things like resources, visibility & stuff. Even when you save a docking layout, in that XML result you can see that the floating split containers are belonging to the RadDocking...
Anyway, the previous code was OK (with a minor change - RanPane pane = e.OriginalSource as RadPane)
Thank you for help!
Regards!
Roxana