在2.0版之前的AvalonDock版本中,有一種屬性可以滿足您的需求。它是DocumentPane.ShowHeader
在2.0中,您必須重寫整個DockingManager樣式,或修改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"/>