Bug in RadPane after saving layout

4 posts, 0 answers
  1. Michael
    Michael avatar
    1 posts
    Member since:
    Oct 2015

    Posted 20 Oct 2015 Link to this post

    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?

  2. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 23 Oct 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Michael
    Michael avatar
    1 posts
    Member since:
    Oct 2015

    Posted 23 Oct 2015 in reply to Vladi Link to this post

    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!

  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 27 Oct 2015 Link to this post

    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
Back to Top