我有一组LayoutAnchorables,我希望用户能够根据需要停靠和浮动。但是,我无法为其设置最大高度或宽度。
我看过AvalonDock的codeplex和wiki,但这对我没有帮助
这是我的Xaml:
<xcad:DockingManager x:Name="DockManager" Grid.Row="1"
AllowMixedOrientation="True"
BorderBrush="Black"
BorderThickness="1"
>
<xcad:DockingManager.DocumentHeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding IconSource}" Margin="0,0,4,0"/>
<TextBlock Text="{Binding Title}" />
</StackPanel>
</DataTemplate>
</xcad:DockingManager.DocumentHeaderTemplate>
<xcad:LayoutRoot x:Name="_layoutRoot">
<xcad:LayoutPanel Orientation="Horizontal">
<xcad:LayoutAnchorablePaneGroup x:Name="Container" DockWidth="4*">
<xcad:LayoutAnchorablePane x:Name="Filter_Pane" DockWidth="1*">
<xcad:LayoutAnchorable x:Name="Filter" Title="Filter" AutoHideWidth="240" AutoHideMinWidth="500" AutoHideMinHeight="200" FloatingHeight="400" FloatingWidth="300" CanFloat="True" FloatingLeft="300" FloatingTop="200" >
<Grid x:Name="Filter_Grid" >
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" x:Name="StackPanel_Filter" />
<StackPanel Orientation="Horizontal" Grid.Row="1" x:Name="Filter_Buttons">
<Button x:Name="Filter_btn_Apply" Content="Apply" Width="60" Height="22" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="5,0,5,5"/>
<Button x:Name="Filter_btn_Clear" Content="Clear" Width="60" Height="22" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="5,0,5,5" Click="Filter_btn_Clear_Click"/>
<Button x:Name="Filter_btn_Close" Content="Close" Width="60" Height="22" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="5,0,5,5" Click="Filter_btn_Close_Click"/>
</StackPanel>
</Grid>
</xcad:LayoutAnchorable>
</xcad:LayoutAnchorablePane>
<xcad:LayoutAnchorablePane x:Name="DataGrid_Pane" DockWidth="4*" >
<xcad:LayoutAnchorable CanFloat="False">
<DataGrid AutoGenerateColumns="True" x:Name="Datagrid_A" Margin="0,-18,0,0" MinColumnWidth="50" MinRowHeight="15" RowBackground="White" AlternatingRowBackground="#FFF0F0F0" AutoGeneratedColumns="Datagrid_A_AutoGeneratedColumns" ColumnHeaderHeight="30" AreRowDetailsFrozen="True" HorizontalGridLinesBrush="#FFB4B4B4" VerticalGridLinesBrush="#FFB4B4B4" Loaded="Datagrid_A_Loaded">
<DataGrid.Resources>
<Style TargetType="DataGridRow">
<EventSetter Event="MouseDoubleClick" Handler="Row_DoubleClick"/>
</Style>
<Style TargetType="DataGridCell">
<Style.Triggers>
<Trigger Property="DataGridCell.IsSelected" Value="True">
<Setter Property="Background" Value="Blue" />
</Trigger>
</Style.Triggers>
</Style>
<Style BasedOn="{StaticResource {x:Type DataGridColumnHeader}}" TargetType="{x:Type DataGridColumnHeader}">
<Setter Property="Background" Value="#FFCDCDD1" />
<Setter Property="BorderBrush" Value="#FFB4B4B4"/>
<Setter Property="BorderThickness" Value="0,0,1,0"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="" Width="*"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</xcad:LayoutAnchorable>
</xcad:LayoutAnchorablePane>
</xcad:LayoutAnchorablePaneGroup>
<xcad:LayoutAnchorablePaneGroup x:Name="Hidden_Windows" DockWidth="1*" >
<xcad:LayoutAnchorablePane x:Name="Pane_Edit">
<xcad:LayoutAnchorable x:Name="Edit" Title="Edit" FloatingHeight="300" FloatingWidth="445" FloatingLeft="1000" FloatingTop="500">
<Grid x:Name="Edit_Grid" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel x:Name="StackPanel_Edit" Grid.Row="0" />
<StackPanel x:Name="Edit_Buttons" Orientation="Horizontal" Grid.Row="1" Height="35" VerticalAlignment="Bottom">
<Button Content="Close" Width="75" Height="30" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="5,0,5,5" Click="Edit_btn_Close_Click"/>
<Button Content="<-" HorizontalAlignment="Center" VerticalAlignment="Bottom" Height="30" Width="30" Click="Button_Click_4" Margin="5,0,5,5"/>
<Button Content="->" HorizontalAlignment="Center" VerticalAlignment="Bottom" Height="30" Width="30" Click="Button_Click_5" Margin="5,0,5,5"/>
<Button x:Name="Btn_Edit_Save" Margin="5,-3,5,5" HorizontalAlignment="Center" Width="75" Height="30" VerticalAlignment="Bottom">
<StackPanel Orientation="Horizontal">
<TextBlock Height="21"><Run Text="Save"/></TextBlock>
<Image Source="/resources/save.png" Height="24" Width="25"/>
</StackPanel>
</Button>
<Button x:Name="btn_Edit_Add" HorizontalAlignment="Center" Margin="5,0,5,5" VerticalAlignment="Bottom" Width="75" Height="30">
<StackPanel Orientation="Horizontal">
<TextBlock Width="24"><Run Text="Add"/></TextBlock>
<Image Source="/resources/Add.png" Height="20" Width="20"/>
</StackPanel>
</Button>
<Button x:Name="btn_Edit_Delete" Margin="5,0,5,5" Height="30" HorizontalAlignment="Center" Width="75" VerticalAlignment="Bottom">
<StackPanel Orientation="Horizontal">
<TextBlock Width="38"><Run Text="Delete"/></TextBlock>
<Image Source="/resources/delete.png" Height="20" Width="25"/>
</StackPanel>
</Button>
</StackPanel>
</Grid>
</xcad:LayoutAnchorable>
</xcad:LayoutAnchorablePane>
<xcad:LayoutAnchorablePane x:Name="Pane_Add">
<xcad:LayoutAnchorable x:Name="Add" Title="Add" FloatingHeight="300" FloatingWidth="445" FloatingLeft="1000" FloatingTop="500" >
<Grid x:Name="Add_Grid" Margin="0,1,-1,-2">
<StackPanel x:Name="StackPanel_Add" Margin="0,0,0,37"/>
<Button Content="Button" Margin="116,0,10,10" Height="22" VerticalAlignment="Bottom" HorizontalAlignment="Center" Width="74"/>
<Button x:Name="Btn_Exit_Add" Content="Exit" Margin="10,0,115,10" Height="22" VerticalAlignment="Bottom" Click="Add_btn_Close_Click" HorizontalAlignment="Center" Width="75"/>
</Grid>
</xcad:LayoutAnchorable>
</xcad:LayoutAnchorablePane>
</xcad:LayoutAnchorablePaneGroup>
</xcad:LayoutPanel>
</xcad:LayoutRoot>
</xcad:DockingManager>
如果无法设置最大和最小宽度和高度,如何禁用浮动LayoutAnchorable的大小?
谢谢您的帮助!