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

Can't set RadPane.Header programatically after LoadLayout

1 Answer 48 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Li
Top achievements
Rank 1
Li asked on 16 May 2012, 10:57 AM
Hello,

I wanted to report a bug. I have a problem setting the Header of a RadPane after LoadLayout in the docking.

There was a thread with the same title half a year ago using Version Q2 2011.
I am using version Q3 2011 and the bug still exists.

I load the layout of a Docking and after the loading i have to set the Headers again. The loaded headers might be not correct because there might have been a language change, so the setting of headers is necessary.

The header of the RadPanes in my Page are not updated. The SerializationTag is set.

I have implemented a sample application.
The xaml:
<UserControl x:Class="Savedocking.MainPage"
        mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
    <telerik:RadDocking x:Name="MainDocking" AllowUnsafeMode="True">
        <telerik:RadSplitContainer  Orientation="Horizontal" InitialPosition="DockedTop" >
            <telerik:RadPaneGroup x:Name="Applications" >
                <telerik:RadPane x:Name="ApplicationsPane" telerik:RadDocking.SerializationTag="ApplicationsPane" Header="initial value" CanUserPin="False" CanUserClose="False" CanFloat="true"  ContextMenuTemplate="{x:Null}">        
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                            <RowDefinition></RowDefinition>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <telerik:RadButton Grid.Row="0" Content="Set Pane header" Click="RadButton_Click"></telerik:RadButton>
                        <telerik:RadButton Grid.Row="1" Content="SaveLayout" Click="RadButton_Click_1"></telerik:RadButton>
                        <telerik:RadButton Grid.Row="2" Content="LoadLayout" Click="RadButton_Click_2"></telerik:RadButton>
                    </Grid>
                </telerik:RadPane>
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>   
    </telerik:RadDocking>
</UserControl>

Code behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.IO;
using System.Text;
using System.Xml;
 
namespace Savedocking
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
 
        private void RadButton_Click(object sender, RoutedEventArgs e)
        {
            ApplicationsPane.Header = "new value";
        }
 
        private string settings ="";
        private void RadButton_Click_1(object sender, RoutedEventArgs e)
        {
            MemoryStream initalSettingsStream = new MemoryStream();
            MainDocking.SaveLayout(initalSettingsStream, true);
            initalSettingsStream.Position = 0;
            byte[] result = new byte[0];
            byte[] bytes = new byte[1024];
            int bytesRead;
            while ((bytesRead = initalSettingsStream.Read(bytes, 0, 1024)) != 0)
            {
                byte[] tempResult = new byte[result.Length + bytesRead];
                if (result.Length > 0)
                {
                    Array.Copy(result, 0, tempResult, 0, result.Length);
                }
                Array.Copy(bytes, 0, tempResult, result.Length, bytesRead);
                result = tempResult;
            }
            settings = System.Text.Encoding.UTF8.GetString(result, 0, result.Length);                      
        }
 
        private void RadButton_Click_2(object sender, RoutedEventArgs e)
        {
            string value = settings;
            if (value != null)
            {
                byte[] bytes = new byte[Encoding.UTF8.GetByteCount(value)];
                char[] chars = value.ToCharArray();
                Encoding.UTF8.GetBytes(chars, 0, chars.Length, bytes, 0);
                MemoryStream stream = new MemoryStream(bytes);
                XmlReader reader = XmlReader.Create(new StringReader(value));
                try
                {
                    MainDocking.LoadLayout(stream);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
    }
}

Pushing the button "set Pane header" sets the header if layout was not loaded.
After saving layout and loading layout (there are the buttons to do this), the header is not updated. If I drag the Pane ot another the document host, the header is updated. I drag it in an area outside the document host, the wrong value is shown.

I can set the correct value if I use Title instead of Header to get the correct value so I have a wrkaround for this issue.

I wanted to know whether there is this bug fixed in a further version?

Thanks and kind regards,
Li

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 21 May 2012, 08:13 AM
Hello Li,

As you can see in the attached video the bug was fixed for Q1 2012 , which is the next release after Q3 2011.

Regards,
Georgi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Docking
Asked by
Li
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or