I got a simple Avalon Dock application. With a test button I can hide and show an LayoutAnchorable in codebehind. Works fine! But after saveing and re-loading the layout to disk the call Hide()/Show() are ignored, no exception, nothing.
Any ideas? Thanks for your help! Haimo
Here is the XAML:
<Window x:Class="AvalonDockTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="clr-namespace:AvalonDockTest" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" Title="MainWindow"
    Width="700" Height="450"
    mc:Ignorable="d">
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <Button x:Name="button" Width="75"
            HorizontalAlignment="Left" Click="OnTestClick"
            Content="Test" />
    <xcad:DockingManager x:Name="_dockMan" Grid.Row="1"
                         MaxHeight="425" AllowMixedOrientation="True"
                         BorderBrush="Black" BorderThickness="1"
                         Theme="{Binding ElementName=_themeCombo,
                                         Path=SelectedItem.Tag}">
        <xcad:LayoutRoot x:Name="_layoutRoot">
            <xcad:LayoutPanel Orientation="Horizontal">
                <xcad:LayoutAnchorablePane DockWidth="200">
                    <xcad:LayoutAnchorable x:Name="_layoutProp" Title="Properties"
                                           AutoHideWidth="240" CanClose="False"
                                           CanHide="False" ContentId="_idProperties">
                        <TextBlock Margin="20" Text="Properties Layout" />
                    </xcad:LayoutAnchorable>
                </xcad:LayoutAnchorablePane>
                <xcad:LayoutDocumentPaneGroup>
                    <xcad:LayoutDocumentPane>
                        <xcad:LayoutDocument Title="Document 1" ContentId="document1">
                            <Button HorizontalAlignment="Center" VerticalAlignment="Center"
                                    Content="Document 1 Content" />
                        </xcad:LayoutDocument>
                    </xcad:LayoutDocumentPane>
                </xcad:LayoutDocumentPaneGroup>
                <xcad:LayoutAnchorablePaneGroup DockWidth="180">
                    <xcad:LayoutAnchorablePane>
                        <xcad:LayoutAnchorable Title="Alarms" ContentId="alarms">
                            <ListBox>
                                <s:String>Alarm 1</s:String>
                                <s:String>Alarm 2</s:String>
                                <s:String>Alarm 3</s:String>
                            </ListBox>
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                </xcad:LayoutAnchorablePaneGroup>
            </xcad:LayoutPanel>
        </xcad:LayoutRoot>
    </xcad:DockingManager>
</Grid>
And this is the CodeBehind:
// ---------- code behind -----
using System;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout.Serialization;
namespace AvalonDockTest
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.Closing += MainWindow_Closing;
            LoadLayout();
        }
        private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            SaveLayout();
        }
        private void OnTestClick(object sender, RoutedEventArgs e)
        {
            if (_layoutProp.IsHidden)     // toggle the LayoutAnchorable
                _layoutProp.Show();     
            else 
                _layoutProp.Hide();
        }
        private void SaveLayout()
        {
            var layoutSerializer = new XmlLayoutSerializer(_dockMan);
            layoutSerializer.Serialize("layout.xml");
        }
        private void LoadLayout()
        {
            var layoutSerializer = new XmlLayoutSerializer(_dockMan);
            layoutSerializer.Deserialize("layout.xml");
        }
    }
}