I have two areas on my interface (using WPF) that I want to be splitted. And a button to change between horisontal and vertical split. I'm using AvalonDock. When I change Orientation parameter in code before running it all works.
<ad:DockingManager Grid.Row="1">
<ad:LayoutRoot>
<ad:LayoutPanel x:Name="LayoutPanel1" Orientation="Vertical" IsMaximized="True">
<ad:LayoutDocumentPane x:Name="DocPane1" ShowHeader="True">
<ad:LayoutDocument Title="Spectrogram" CanClose="False" CanFloat="False">
<wpf:CartesianChart Series="{Binding MySeries}" Zoom="X"/>
</ad:LayoutDocument>
</ad:LayoutDocumentPane>
<ad:LayoutDocumentPane x:Name="DocPane2" ShowHeader="True">
<ad:LayoutDocument Title="Table" CanClose="False" CanFloat="False">
<TextBox Name="textbox1" />
</ad:LayoutDocument>
</ad:LayoutDocumentPane>
</ad:LayoutPanel>
</ad:LayoutRoot>
</ad:DockingManager>
But it doesn't change on a button click here. Nothing happens but when I try dragging the splitter which remained in place the program crashes.
private void OnChangeView(object sender, RoutedEventArgs e)
{
if (LayoutPanel1.Orientation == Orientation.Vertical) {
LayoutPanel1.Orientation = Orientation.Horizontal;
} else {
LayoutPanel1.Orientation = Orientation.Vertical;
}
}
I debugged it, the property itself changes. Don't know what the problem is... Or maybe you know a better way to implement this, but I might need AvalonDock later too.