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

Ignore header/title from XMLwhen Loading layout

1 Answer 15 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Arnstein
Top achievements
Rank 1
Arnstein asked on 06 Jan 2014, 10:11 AM
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

1 Answer, 1 is accepted

Sort by
0
Accepted
Kalin
Telerik team
answered on 08 Jan 2014, 11:33 AM
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 >>
Tags
Docking
Asked by
Arnstein
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or