我有AvalonDock 2
LayoutAnchorablePane
如下,
<xcad:DockingManager
AnchorablesSource="{Binding AnchorableSource}"
DocumentsSource="{Binding DocumentSource}"
Utility:AvalonDockLayoutSerializer.LoadLayoutCommand="{Binding LoadLayoutCommand}"
Utility:AvalonDockLayoutSerializer.SaveLayoutCommand="{Binding SaveLayoutCommandOnExit}">
<xcad:DockingManager.Theme>
<xcad:MetroTheme />
</xcad:DockingManager.Theme>
<xcad:DockingManager.LayoutUpdateStrategy>
<Pane:LayoutInitializer/>
</xcad:DockingManager.LayoutUpdateStrategy>
<xcad:DockingManager.Resources>
<DataTemplate DataType="{x:Type ViewModels:ExplorerViewModel}">
<Views:ExplorerView />
</DataTemplate>
<DataTemplate DataType="{x:Type ViewModels:TableOfContentViewModel}">
<Views:TableOfContentView x:Name="TOCView" Focusable="True">
<Views:TableOfContentView.InputBindings>
<KeyBinding Key="F5" Command="{Binding GridF5Command}"/>
</Views:TableOfContentView.InputBindings>
</Views:TableOfContentView>
</DataTemplate>
<DataTemplate DataType="{x:Type ViewModels:PropertyViewModel}">
<Views:PropertyView />
</DataTemplate>
<DataTemplate DataType="{x:Type ViewModels:SearchViewModel}">
<Views:SearchPanel />
</DataTemplate>
<DataTemplate DataType="{x:Type ViewModels:DocumentViewModel}">
<Views:DocumentView />
</DataTemplate>
</xcad:DockingManager.Resources>
<xcad:DockingManager.LayoutItemContainerStyleSelector>
<Pane:PanesStyleSelector>
<Pane:PanesStyleSelector.ToolStyle>
<Style TargetType="{x:Type xcad:LayoutAnchorableItem}">
<Setter Property="Title" Value="{Binding Model.Title}"/>
<Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter={x:Static Visibility.Hidden}}"/>
<Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
<Setter Property="FlowDirection" Value="LeftToRight"/>
<Setter Property="UseLayoutRounding" Value="False"/>
</Style>
</Pane:PanesStyleSelector.ToolStyle>
<Pane:PanesStyleSelector.FileStyle>
<Style TargetType="{x:Type xcad:LayoutItem}">
<Setter Property="Title" Value="{Binding Model.Title}"/>
<Setter Property="ToolTip" Value="{Binding Model.FilePath}"/>
<Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
<Setter Property="CanClose" Value="False"/>
</Style>
</Pane:PanesStyleSelector.FileStyle>
</Pane:PanesStyleSelector>
</xcad:DockingManager.LayoutItemContainerStyleSelector>
<xcad:LayoutRoot>
<xcad:LayoutPanel Orientation="Horizontal">
<xcad:LayoutAnchorablePane Name="Explorer" DockMinWidth="200" FloatingWidth="200"/>
<xcad:LayoutAnchorablePane Name="TOC" DockMinWidth="630"/>
<xcad:LayoutAnchorablePaneGroup Orientation="Vertical" DockMinWidth="300">
<xcad:LayoutAnchorablePane Name="Property" />
<xcad:LayoutAnchorablePane Name="Search" />
</xcad:LayoutAnchorablePaneGroup>
<xcad:LayoutDocumentPane>
</xcad:LayoutDocumentPane>
</xcad:LayoutPanel>
</xcad:LayoutRoot>
</xcad:DockingManager>
如何为AutoHideMinWidth
设置AutoHideMinHeight
和LayoutAnchorable
。
答案 0 :(得分:1)
不幸的是,LayoutAnchorable
或LayoutAnchorablePane
都不是FramworkElement
,因此您无法应用全局样式来设置AutoHideMinWidth
和AutoHideMinHeight
属性,
这里唯一的选择是下载AvalonDock 2.0源代码:
http://avalondock.codeplex.com/SourceControl/latest#Version2.0/
添加项目并将其引用到您的解决方案中。 在Xceed.Wpf.AvalonDock项目/Layout/LayoutAnchorable.cs 下,将AutoHideMinWidth
和AutoHideMinHeight
默认值更新为最适合您的值。
#region AutoHideMinWidth
private double _autohideMinWidth = 100.0; //default value
public double AutoHideMinWidth
{
get { return _autohideMinWidth; }
set
{
if (_autohideMinWidth != value)
{
RaisePropertyChanging("AutoHideMinWidth");
if (value < 0)
throw new ArgumentException("value");
_autohideMinWidth = value;
RaisePropertyChanged("AutoHideMinWidth");
}
}
}