Our application utilizes Rad Docking Serialization.
The application has a DocumentHost with several tabbed Panes. When a new Pane is added to the application inside the DocumentHost, it's not initially displayed after the docking serialization is read in. But we hook a toggle button up to each pane to control visibility and clicking the button brings the new pane into view.
Here's the problem.
When we add a new Pane outside of the DocumentHost, the trick above doesn't work. The pane will not be seen unless the serialization is deleted.
I found mention of using LayoutSerializationLoadingEventArgs but could not find an example.
Is there an event I can catch to add the new pane to the serialization?
Or should this just work, and there's something wrong with my implementation?
Thanks
8 Answers, 1 is accepted
The ElementLoading event is raised when a docking element (Pane, PaneGroup or SplitContainer) is about to be loaded. You could refer to our online documentation - http://www.telerik.com/help/wpf/raddocking-save-load-the-content-of-the-panes.html. The RadDocking cannot save the Content of the panes itself. You need to set the Content of each pane manually in the ElementLoading event handler if these panes are generated in runtime.
Please do not hesitate to contact us if you require any further information.
George
the Telerik team
My problem is not that I am trying to restore the contents of a pane, but the actual visibility of a NEW pane.
Let me describe another way. Our users have had the application for several months. They get a new version of the application that has a new feature - a pane that shows a list of report configurations they can run.
However, they won't see that new pane - maybe because it wasn't in their serialization file.
We bind the "IsHidden" property of the new pane to the state of a toggle button. But toggling that button does not bring the new pane into view.
If we delete the docking serialization file, the new pane is shown (and the toggle button works).
This shed some light on the problem. I would suggest you to add the new RadPane in the code behind after the RadDocking.LoadLayout() method is called. In this way, you will ensure that the new RadPane will not be overriden from the old xml.
George
the Telerik team
First,I called Docking.LoadLayout() method to load layout.
Second,I use code to add a new RadPane to the Docking,
RadPane rp =
new
RadPane();
rp.Header = fi.Code +
" "
+ fi.CycleName;
rp.Title = rp.Header;
rp.Tag = fi.Key;
rp.IsHidden =
false
;
fi.IsShow =
true
;
RadDocking.SetSerializationTag(rp, fi.Key);
this
.GroupDocument.AddItem(rp, Telerik.Windows.Controls.Docking.DockPosition.Center);
I would suggest you to use the RadPaneGroup.Items.Add method, not the RadPaneGroup.AddItem.
Please, let me know if this helps.
George
the Telerik team
Thank you,but it dosn't work. here is the code
private void radButton1_Click(object sender, RoutedEventArgs e)
{
RadPane rp = new RadPane();
rp.Header = DateTime.Now.ToString("yyyyMMddHHmmssfff");
rp.Title = rp.Header;
RadDocking.SetSerializationTag(rp, rp.Header.ToString());
this.GroupDocument.Items.Add(rp);
}
using (Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(xml)))
{
stream.Seek(0, SeekOrigin.Begin);
this.Docking.LoadLayout(stream);
}
RadPane rp = new RadPane();
rp.Header = DateTime.Now.ToString("yyyyMMddHHmmssfff");
rp.Title = rp.Header;
RadDocking.SetSerializationTag(rp, rp.Header.ToString());
((Telerik.Windows.Controls.RadPaneGroup)((Telerik.Windows.Controls.RadSplitContainer)Docking.DocumentHost).Items[0]).Items.Add(rp); //need like this.....
Thank you
When the layout is loaded, the reference to that RadPaneGroup is changed. I would suggest you to add a SerializationTag to this group as well. This will resolve the problem.
All the best,
George
the Telerik team