LoadLayout() localization issue

2 posts, 1 answers
  1. Pierre
    Pierre avatar
    23 posts
    Member since:
    Oct 2015

    Posted 24 Nov 2015 Link to this post

    I was trying to figure out why the titles of my RadPanes were not being translated.  I finally figured out that the LoadLayout() also loads the header of the panes and that overrides my XAML's {x:Static properties:Resources.xxx}.

    I could say "After the LoadLayout(), change the title of each pane according to the resource strings" but it would be nice if it could be done directly in the XAML.  I don't believe there's a way to prevent the "Header" tag from being included in the SaveLayout/LoadLayout functions, right?  To tell you the truth, I don't even see why the header is included at all!


  2. Answer
    Vladi avatar
    749 posts

    Posted 27 Nov 2015 Link to this post

    Hello Pierre,

    Thank you for contacting us.

    By design in the current version of the RadDocking control when its SaveLayout built-in functionality is used only the most important properties of the each element are persisted. There are couple of exceptions to this persistence mechanism and one is when a binding is used for a specific property. In such cases that property is not persisted as it could lead to a binding expression that the RadDocking cannot resolve. As such values should come from the ViewModel rather that the View (the RadDocking control) after loading the layout you will need to restore the bindings manually. The same goes for the content of the RadPane instances, you can take a look at this article from our documentation that goes in deeper details on this case. There are also scenarios where the value of a property is directly persisted, this happens when a property (for example the Header) is set to a string. This is why when using static localization by setting the "{x:Static properties:Resources.xxx" that value is persisted by the SaveLayout functionality. Because this declaration of the property directly sets a string to the RadPane's Header the control's SaveLayout functionality saves its value. In order to resolve such scenario you could rather than statically set the Header property in the XAML, create a property in your ViewModel and simply get the value for that property using the projects localization resources.

    I create a sample project of the described approaches, hope this is helpful. You can find the sample project attached to my response.

    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