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

Bug in RadPane after saving layout

3 Answers 54 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 20 Oct 2015, 07:33 PM

If you are using a HeaderTemplate and save the layout, when the layout is loaded next the headertemplate is blown away and replaced with a TextBlock.  Title works just fine and is able to apply it's template.

 

I believe the code bug is in DockingLayoutFactory.cs in the RadPane LoadPane(XmlReader reader) method

 

 public RadPane LoadPane(XmlReader reader)
        {
            string name = reader.Name;
            Dictionary<string, string> attributes = ReadAttributes(reader);
            RadPane elementByTypeName = null;
            if (attributes.ContainsKey("SerializationTag"))
            {
                elementByTypeName = this.docking.NotifyElementLoading(attributes["SerializationTag"]) as RadPane;
            }
            if (elementByTypeName == null)
            {
                elementByTypeName = this.GetElementByTypeName(this.docking.GeneratedItemsFactory, name) as RadPane;
            }
            if (elementByTypeName == null)
            {
                throw new InvalidOperationException();
            }
            if (attributes.ContainsKey("SerializationTag"))
            {
                RadDocking.SetSerializationTag(elementByTypeName, attributes["SerializationTag"]);
            }
            ReadProperty(attributes, elementByTypeName, RadPane.IsPinnedProperty, "IsPinned", boolParser);
            ReadProperty(attributes, elementByTypeName, RadPane.IsHiddenProperty, "IsHidden", boolParser);
            ReadProperty(attributes, elementByTypeName, RadPane.TitleProperty, "Title", identityParser);
            ReadProperty(attributes, elementByTypeName, HeaderedContentControl.HeaderProperty, "Header", identityParser);​

The above line should most likely read:  ReadProperty(attributes, elementByTypeName, RadPane.HeaderProperty, "Header", identityParser);​

It looks that's why the control template is getting blown away.

 Anyway to get this fixed?

3 Answers, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 23 Oct 2015, 03:22 PM
Hi Michael,

Thank you for contacting us.

In order to keep the generated XML by the SaveLayout functionality small and clean only the most important properties of the control are saved to that XML. Those properties are the properties related to position, size etc. of the elements in the RadDocking control. By design the SaveLayout functionality does not persist the HeaderTemplate of the RadPane instance which is why when loading the layout that template is replaced by the default one from the control's theme. When applying custom Styles and Templates to the RadDocking elements and the save/load layout functionality is used it is best to create a global Style for the specific element (RadPane) and leave that Style without an x:Key. This way the default Style that is usually used when loading an layout will be overridden and the custom one will be used instead. I created and attached a sample project for you that shows the described approach, hope this is helpful.

It is worth mentioning that there is an feedback item for allowing our users to write a custom Save/LoadLAyout functionality which could be used to specify which properties are persisted and how they are resolved. You can vote and track that feature request here. If we can be of any further assistance feel free to write to us again.


Regards,
Vladi
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Michael
Top achievements
Rank 1
answered on 23 Oct 2015, 03:46 PM

Thanks for the response.  I do understand I can restyle the whole control, and probably will in the meantime.  I do still believe this is a bug though.  I don't see any reason why you are setting the Header content template with the saved text instead of the RadPane.Header dependency property.  This is contrary to what is done with the Title property and it is able to persist it's TitleTemplate just fine.  I suggest you try changing the code like I suggested and see if the HeaderTemplate is persisted.

 

Thanks!

0
Vladi
Telerik team
answered on 27 Oct 2015, 09:42 AM
Hi Michael,

Thank you for your suggestions and for bringing this scenario to our attention.

We will further research the described scenario in order to fully cover its use cases and provide the best improvements to the RadDocking control. You can keep an eye on our release notes history directly here, where you can find all of the latest new features, improvements and bug fixes.

Regards,
Vladi
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Docking
Asked by
Michael
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Michael
Top achievements
Rank 1
Share this question
or