I am stymied as to how to set the size of a LayoutAnchorable (or the pane that contains it) when redocking, or when switching from doc to floating. (FYI:DockHeight / DockWidth only sets the initial height / width). I've constructed a trivial example below, which contains:
The behavior I would like is akin to how 'Auto' works in most wpf controls. That is,
I've tried many different schemes to somehow alter the height configuration (which I assume would also apply to width), with zero luck.
<Window x:Class="ExceedFullAvalon.MainWindow"
-
At the window's top is a single LayoutPane containing a LayoutAnchorable (titled 'Controls'), which in turn contains a single button,
-
Below that is a single LayoutDocumentPane containing two horizontally arranged LayoutDocuments (titled 'Document1' and 'Document2'), each containing a text box
The behavior I would like is akin to how 'Auto' works in most wpf controls. That is,
- when the Controls pane is dragged out to float, the height will just fit the button height (it is currently smaller)
-
when the Controls pane is re-docked at the top, the height will just fit the button height (it currently divides the window in half, which is way too large).
I've tried many different schemes to somehow alter the height configuration (which I assume would also apply to width), with zero luck.
<Window x:Class="ExceedFullAvalon.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ExceedFullAvalon"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:xcad="http://schemas.xceed.com/wpf/xaml/avalondock"
xmlns:s="clr-namespace:System;assembly=mscorlib">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<xcad:DockingManager Grid.Row="0" BorderBrush="Black" BorderThickness="1" >
<xcad:LayoutRoot x:Name="_layoutRoot">
<xcad:LayoutPanel x:Name="_layoutPanel" Orientation="Vertical" CanRepositionItems="False">
<xcad:LayoutAnchorablePane x:Name="_LayoutAnchorablePane" DockHeight="Auto" >
<xcad:LayoutAnchorable x:Name="_LayoutAnchorable" ContentId="properties" Title="Controls" CanClose="False" CanAutoHide="False" CanHide="False">
<Button Content="Button 1" Margin="5" Height="20" Width="100" Grid.Row="0"/>
</xcad:LayoutAnchorable>
</xcad:LayoutAnchorablePane>
<xcad:LayoutDocumentPane x:Name="_LayoutDocumentPane" CanRepositionItems="False" DockHeight="*">
<xcad:LayoutDocument x:Name="_LayoutDocument1" ContentId="document1" Title="Document 1" CanFloat="False" CanClose="False" >
<TextBox Text="Document 1 Content" />
</xcad:LayoutDocument>
<xcad:LayoutDocument x:Name="_LayoutDocument2" ContentId="document2" Title="Document 2" CanFloat="False" CanClose="False" >
<TextBox Text="Document 2 Content" />
</xcad:LayoutDocument>
</xcad:LayoutDocumentPane>
</xcad:LayoutPanel>
</xcad:LayoutRoot>
</xcad:DockingManager>
</Grid></Window>