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

Disappearing panes after LoadLayout

2 Answers 91 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Austin
Top achievements
Rank 1
Austin asked on 14 Nov 2011, 05:59 PM
In some circumstances a RadPaneGroup will not show content using a loaded layout. Can reproduce with controls version 2011.2.1010.1040 and 2011.3.1020.1040.

To reproduce:

  1. Dock the second pane on the right side of the split container (see docking_layout.png)
  2. Save the layout
  3. Refresh the application
  4. Load the layout
  5. Make the second pane hidden
  6. Make the second pane visible (see docking_problem.png)

Example XAML:

<UserControl x:Class="DockingPersistence.MainPage"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
 
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
 
        <StackPanel Orientation="Horizontal">
            <Button Content="Save Layout" Click="Save_Click"/>
            <Button Content="Load Layout" Click="Load_Click"/>
 
            <CheckBox IsChecked="{Binding FirstPaneIsHidden, Mode=TwoWay}" Content="First pane IsHidden"/>
            <CheckBox IsChecked="{Binding SecondPaneIsHidden, Mode=TwoWay}" Content="Second pane IsHidden"/>
        </StackPanel>
         
        <telerik:RadDocking x:Name="Dock" Grid.Row="2">
            <telerik:RadSplitContainer telerik:RadDocking.SerializationTag="DefaultContainer" InitialPosition="DockedBottom">
                <telerik:RadPaneGroup x:Name="DefaultGroup" telerik:RadDocking.SerializationTag="DefaultGroup">
                    <telerik:RadPane Title="First" IsHidden="{Binding FirstPaneIsHidden, Mode=TwoWay}" telerik:RadDocking.SerializationTag="FirstPane">
                        This is the FIRST pane.
                    </telerik:RadPane>
                    <telerik:RadPane Title="Second" IsHidden="{Binding SecondPaneIsHidden, Mode=TwoWay}" telerik:RadDocking.SerializationTag="SecondPane">
                        This is the SECOND pane.
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
        </telerik:RadDocking>
    </Grid>
</UserControl>

Example CS:
using System.ComponentModel;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using Telerik.Windows.Controls;
 
namespace DockingPersistence
{
    public partial class MainPage : UserControl, INotifyPropertyChanged
    {
        public MainPage()
        {
            InitializeComponent();
            DataContext = this;
        }
 
        private bool _firstPaneIsHidden;
        public bool FirstPaneIsHidden
        {
            get { return _firstPaneIsHidden; }
            set { _firstPaneIsHidden = value; NotifyPropertyChanged("FirstPaneIsHidden"); }
        }
 
        private bool _secondPaneIsHidden;
        public bool SecondPaneIsHidden
        {
            get { return _secondPaneIsHidden; }
            set { _secondPaneIsHidden = value; NotifyPropertyChanged("SecondPaneIsHidden"); }
        }
 
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();
            if (dialog.ShowDialog() == true)
            {
                using (Stream stream = dialog.OpenFile())
                {
                    Dock.SaveLayout(stream);
                }
            }
        }
 
        private void Load_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            if (dialog.ShowDialog() == true)
            {
                using (Stream stream = dialog.File.OpenRead())
                {
                    Dock.LoadLayout(stream);
                }
            }
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
    }
}



2 Answers, 1 is accepted

Sort by
0
Austin
Top achievements
Rank 1
answered on 14 Nov 2011, 06:10 PM
The simplest solution I've found is to not provide a serialization tag for the split container...
0
Ivo
Telerik team
answered on 17 Nov 2011, 03:48 PM
Hi Austin,

As shown into this article, SerializationTag has to be applied only to RadPanes and RadPaneGroups, and not to RadSplitContainers

Kind regards,
Ivo
the Telerik team

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

Tags
Docking
Asked by
Austin
Top achievements
Rank 1
Answers by
Austin
Top achievements
Rank 1
Ivo
Telerik team
Share this question
or