Skip to content

Commit

Permalink
fix layoutContent.TabItem is null,
Browse files Browse the repository at this point in the history
fix document header disappear
  • Loading branch information
LyonJack committed Jul 3, 2020
1 parent 6ec1e30 commit 1c1f266
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
7 changes: 4 additions & 3 deletions source/Components/AvalonDock.Themes.Aero/Theme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,6 @@
</Style>

<Style TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
<Setter Property="ContentTemplate" Value="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="ContentTemplateSelector" Value="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
Expand All @@ -1025,7 +1023,10 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="3" Background="Transparent" />
<ContentPresenter />
<ContentPresenter
Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
ContentTemplateSelector="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<!-- Close button should be moved out to the container style -->
<Button
x:Name="DocumentCloseButton"
Expand Down
7 changes: 4 additions & 3 deletions source/Components/AvalonDock.Themes.Expression/Theme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,6 @@
</Style>

<Style TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
<Setter Property="ContentTemplate" Value="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="ContentTemplateSelector" Value="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
Expand All @@ -897,7 +895,10 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="Transparent" />
<ContentPresenter />
<ContentPresenter
Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
ContentTemplateSelector="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<!-- Close button should be moved out to the container style -->
<Button
x:Name="DocumentCloseButton"
Expand Down
7 changes: 4 additions & 3 deletions source/Components/AvalonDock.Themes.Metro/Theme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1029,8 +1029,6 @@
</Style>

<Style TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
<Setter Property="ContentTemplate" Value="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="ContentTemplateSelector" Value="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
Expand All @@ -1047,7 +1045,10 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="3" Background="Transparent" />
<ContentPresenter />
<ContentPresenter
Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
ContentTemplateSelector="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<!-- Close button should be moved out to the container style -->
<Button
x:Name="DocumentCloseButton"
Expand Down
7 changes: 4 additions & 3 deletions source/Components/AvalonDock.Themes.VS2010/Theme.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1075,8 +1075,6 @@
</Style>

<Style TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
<Setter Property="ContentTemplate" Value="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="ContentTemplateSelector" Value="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
Expand All @@ -1093,7 +1091,10 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="3" Background="Transparent" />
<ContentPresenter />
<ContentPresenter
Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
ContentTemplateSelector="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<!-- Close button should be moved out to the container style -->
<Button
x:Name="DocumentCloseButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1348,8 +1348,6 @@
</Style>

<Style TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
<Setter Property="ContentTemplate" Value="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="ContentTemplateSelector" Value="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
Expand All @@ -1368,7 +1366,12 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="Transparent" />
<ContentPresenter Margin="4,0" TextBlock.Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TabItem}}" />
<ContentPresenter
Margin="4,0"
Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
ContentTemplateSelector="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
TextBlock.Foreground="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TabItem}}" />
<!-- Close button should be moved out to the container style -->
<Button
x:Name="DocumentCloseButton"
Expand Down
8 changes: 5 additions & 3 deletions source/Components/AvalonDock/Themes/generic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,6 @@
</Style>

<Style TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
<Setter Property="ContentTemplate" Value="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="ContentTemplateSelector" Value="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type avalonDockControls:LayoutDocumentTabItem}">
Expand All @@ -771,7 +769,11 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="3" Background="Transparent" />
<ContentPresenter />
<ContentPresenter
Content="{Binding Model, RelativeSource={RelativeSource TemplatedParent}}"
ContentTemplate="{Binding DocumentHeaderTemplate, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}"
ContentTemplateSelector="{Binding DocumentHeaderTemplateSelector, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type avalonDock:DockingManager}, Mode=FindAncestor}}" />

<Button
x:Name="DocumentCloseButton"
Grid.Column="2"
Expand Down

0 comments on commit 1c1f266

Please sign in to comment.