在 2.0 之前的 AvalonDock 版本中,有一个属性可以满足您的需求。它是DocumentPane.ShowHeader
在 2.0 中,您要么必须重写整个 DockingManager Style,要么修改 AvalonDock。
我在问题跟踪器中为此创建了一个问题,并附上了一个补丁,您可以下载该补丁以再次使用。
此补丁是针对先前版本制作的,如果将其应用于当前版本,可能需要进行一些调整。此外,它不处理此后发布的新主题。
http://avalondock.codeplex.com/workitem/15626
修补:
Index: AvalonDock/AvalonDock.Theme.VS2010/Theme.xaml
===================================================================
--- AvalonDock/AvalonDock.Theme.VS2010/Theme.xaml (revision 96146)
+++ AvalonDock/AvalonDock.Theme.VS2010/Theme.xaml (working copy)
@@ -93,7 +93,9 @@
</Grid.RowDefinitions>
<!--Following border is required to catch mouse events-->
<Border Background="Transparent" Grid.RowSpan="2"/>
- <Grid Panel.ZIndex="1">
+ <Grid Grid.Row="0"
+ Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type avalonDockControls:LayoutDocumentPaneControl}}, Path=Model.ShowHeader, Converter={StaticResource BoolToVisibilityConverter}}"
+ Panel.ZIndex="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
Index: AvalonDock/AvalonDock.Themes.Aero/Theme.xaml
===================================================================
--- AvalonDock/AvalonDock.Themes.Aero/Theme.xaml (revision 96146)
+++ AvalonDock/AvalonDock.Themes.Aero/Theme.xaml (working copy)
@@ -38,7 +38,9 @@
</Grid.RowDefinitions>
<!--Following border is required to catch mouse events-->
<Border Background="Transparent" Grid.RowSpan="2"/>
- <Grid Panel.ZIndex="1" >
+ <Grid Grid.Row="0"
+ Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type avalonDockControls:LayoutDocumentPaneControl}}, Path=Model.ShowHeader, Converter={StaticResource BoolToVisibilityConverter}}"
+ Panel.ZIndex="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
Index: AvalonDock/AvalonDock/Layout/LayoutDocumentPane.cs
===================================================================
--- AvalonDock/AvalonDock/Layout/LayoutDocumentPane.cs (revision 96146)
+++ AvalonDock/AvalonDock/Layout/LayoutDocumentPane.cs (working copy)
@@ -49,6 +49,27 @@
return true;
}
+ #region ShowHeader
+ private bool _showHeader = true;
+
+ public bool ShowHeader
+ {
+ get
+ {
+ return _showHeader;
+ }
+ set
+ {
+ if (value != _showHeader)
+ {
+ this._showHeader = value;
+ RaisePropertyChanged("ShowHeader");
+ }
+ }
+ }
+
+ #endregion
+
#region SelectedContentIndex
private int _selectedIndex = -1;
Index: AvalonDock/AvalonDock/Themes/generic.xaml
===================================================================
--- AvalonDock/AvalonDock/Themes/generic.xaml (revision 96146)
+++ AvalonDock/AvalonDock/Themes/generic.xaml (working copy)
@@ -28,7 +28,9 @@
</Grid.RowDefinitions>
<!--Following border is required to catch mouse events-->
<Border Background="Transparent" Grid.RowSpan="2"/>
- <Grid Panel.ZIndex="1">
+ <Grid Grid.Row="0"
+ Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type avalonDockControls:LayoutDocumentPaneControl}}, Path=Model.ShowHeader, Converter={StaticResource BoolToVisibilityConverter}}"
+ Panel.ZIndex="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>