This is a migrated thread and some comments may be shown as answers.

DockPanel serialization_ doesn't persit "name" property for panels

8 Answers 229 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Dragos
Top achievements
Rank 1
Dragos asked on 20 Jan 2010, 01:33 PM
I'm evaluating RadDocking control.

I'm trying to persist layout data in userprofle and then reloading the layout.
When I'm reloading layout I'm observing that "name" or "tag"  or even other internal property for properly identification
at loading time doesn't serialize properly (They have empty value). I need an id property to be serialized to be able to restore the layout properly at deserialize (matching panel content hosting of dockingPanel layout with the proper UIElemets)
Sample code:
//Saving:
using (MemoryStream stream = new MemoryStream())
            {
                foreach (RadPane pane in dockPanelMgr.Panes)
                {
                    //I'm trying set-up Tag property for serialization if
                    pane.Tag = pane.Name;
                }
                dockPanelMgr.SaveLayout(stream);

ServiceProvider.Get<Settings>()
                    .Layout.LayoutSerialization =
                    UTF8Encoding.UTF8.GetString(stream.GetBuffer());
}

ServiceProvider.Get<Settings>().Save();

//Loading:

string layout = ServiceProvider.Get<Settings>().Layout.LayoutSerialization;

                using (MemoryStream ms = new MemoryStream(UTF8Encoding.UTF8.GetBytes(layout)))
                {
                                           dockPanelMgr.LoadLayout(ms);
}

8 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 21 Jan 2010, 09:27 AM
Hello Dragos,

 Do you set the RadDocking.SerializationTag attached property to the controls you would like to identify after that? If yes, you could use its value as ID. If you don't set it you should keep in mind that the Docking control is using this attached property to identify the elements.

Unfortunately as you correctly noticed the Docking control doesn't serialize the Name and Tag properties. It doesn't serialize the Name property to prevent eventual name conflicts and cannot serialize the Tag property as it is of type Object and the Docking control doesn't know how to serialize objects of type Object.

Regards,
Miroslav Nedyalkov
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
Dragos
Top achievements
Rank 1
answered on 21 Jan 2010, 10:19 AM
Hi,
 First of all thank you for your promptitude.

If I made a simple task: SaveLayout of RadDocking and then LoadLayout again I'll have an empty RadDocking (All existing business Controls linked on old layout wouldn't be linked again for new layout). So I have to relinked it again.

Tag can be involved in serialization property accepted by RadDocking because xmlSerializer automatically serialize based type (string, int or what ever). I'm made sure that assigned property for tag is string type.

I have below an xml sample obtained by serialization of your dockingControl. I cannot to identify the host where can I linked my control based on Header or Title property for panel . The serialization issue exists only to restore the desired user layout linked on business controls. How can I do that?
<?xml version="1.0" encoding="utf-8" ?>
- <RadDocking>
- <DocumentHost>
- <RadSplitContainer>
- <Items>
- <RadPaneGroup SelectedIndex="0">
- <Items>
  <RadDocumentPane IsDockable="True" CanUserClose="False" CanFloat="False" />
  </Items>
  </RadPaneGroup>
  </Items>
  </RadSplitContainer>
  </DocumentHost>
- <SplitContainers>
- <RadSplitContainer Dock="DockedLeft" Width="189" Orientation="Vertical">
- <Items>
- <RadPaneGroup SelectedIndex="0">
- <Items>
  <RadPane IsDockable="True" Title="DocumentTree" Header="DocumentTree" CanUserClose="False" CanDockInDocumentHost="False" />
  </Items>
  </RadPaneGroup>
  </Items>
  </RadSplitContainer>
- <RadSplitContainer Dock="DockedRight" Width="259">
- <Items>
- <RadPaneGroup SelectedIndex="0">
- <Items>
  <RadPane IsDockable="True" Title="Index header" Header="Index header" CanUserClose="False" CanDockInDocumentHost="False" />
  </Items>
  </RadPaneGroup>
  </Items>
  </RadSplitContainer>
- <RadSplitContainer Dock="DockedBottom" Height="180">
- <Items>
- <RadPaneGroup SelectedIndex="0">
- <Items>
  <RadPane IsDockable="True" Title="Detail" Header="Detail" CanUserClose="False" CanDockInDocumentHost="False" />
  </Items>
  </RadPaneGroup>
  </Items>
  </RadSplitContainer>
  </SplitContainers>
  </RadDocking>
0
Accepted
Miroslav Nedyalkov
Telerik team
answered on 21 Jan 2010, 12:53 PM
Hello Dragos,

 I can see in your XML that you didn't set the RadDocking.SerializationTag property to any of the items in the docking control (it would be serialized in other case). If you set it to all of the panes, the Docking control will take care of the relinking the controls in the panes (it accomplishes the task correctly in most of the cases). Please, refer to the following article that demonstrates how to use the serialization of the Docking control - http://blogs.telerik.com/miroslavnedyalkov/posts/09-04-22/raddocking_save_load_layout.aspx

Best wishes,
Miroslav Nedyalkov
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
Dragos
Top achievements
Rank 1
answered on 21 Jan 2010, 01:16 PM
Tkx,

It's worked! I've inspect deeply radDocking properties.

..............
 <telerikDocking:RadPaneGroup>
                        <telerikDocking:RadDocumentPane  
                            CanFloat="False" CanUserClose="False" Name="dpImageViewer"
                            telerik:RadDocking.SerializationTag="dpImageViewer">

..............
0
Miguel Madero
Top achievements
Rank 1
answered on 06 Jun 2011, 08:31 AM
I tried setting the IsDockable property, but it's Internal. I noticeed in this example that it's set to to true. Is this a different version? I'm using Docking.dll version 2011.1.419.40.

Am I missing something?     
0
Miroslav Nedyalkov
Telerik team
answered on 07 Jun 2011, 08:56 AM
Hello Miguel,

You don't need to set this property to true - this is its default value. The panes can became non-dockable only if they are FloatingOnly which can be achieved by calling the MakeFloatingOnly method of the pane or by setting the InitialPosition of its SplitContainer to FloatingOnly.

Hope this information is helpful.

Regards,
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
Miguel Madero
Top achievements
Rank 1
answered on 07 Jun 2011, 11:20 AM
I found what I was after, I really just wanted to stop the user from moving the panels around. CanUserPin is what I was after. They found it confusing. 

Thanks
0
Miroslav Nedyalkov
Telerik team
answered on 07 Jun 2011, 01:35 PM
Hi Miguel,

 It's good to hear that you found what you were looking for.

Kind regards,
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
Tags
Docking
Asked by
Dragos
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Dragos
Top achievements
Rank 1
Miguel Madero
Top achievements
Rank 1
Share this question
or