Ignore header/title from XMLwhen Loading layout

2 posts, 1 answers
  1. Arnstein
    Arnstein avatar
    36 posts
    Member since:
    Oct 2012

    Posted 06 Jan 2014 Link to this post

    When you save a layout the header and title is also persisted. Is there an easy way to ignore the persisted header and always use the one currently defined header from the XAML. Over time a header might change for a RadPane, and we want the users to see the new header, not the old persisted header.

    In the element loaded event it's possible to set the header, but how would I get the current header from the "real" RadPane and not the persisted one?

    Best regards
    Arnstein Volden


    Telerik version: 2013.3.1204.40
  2. Answer
    Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 08 Jan 2014 Link to this post

    Hi Arnstein,

    The Docking Save/Load layout mechanism works that way - it totally replaces the current Docking in XAML with the persisted one. However you could achieve the desired behavior by handling the ElementLoaded and ElementLoading events of the Docking. In the ElementLoading you can get the current Pane and save its Header in variable, right after that the ElementLoaded is called and this is where you can set that header to the persisted Pane. Check the following code snippet for more details:

    private string currentHeader;
     
    private void Docking_ElementLoaded(object sender, LayoutSerializationEventArgs e)
    {
        var pane = e.AffectedElement as RadPane;
        pane.Header = this.currentHeader;
    }
     
    private void Docking_ElementLoading(object sender, LayoutSerializationLoadingEventArgs e)
    {
        var pane = e.AffectedElement as RadPane;
        this.currentHeader = pane.Header.ToString();
    }

    Hope this works for you.

    Regards,
    Kalin
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top