|
31 | 31 | <ControlTemplate TargetType="{x:Type TabControl}"> |
32 | 32 | <DockPanel KeyboardNavigation.TabNavigation="Local"> |
33 | 33 | <wpf:ColorZone x:Name="PART_HeaderZone" |
34 | | - VerticalAlignment="Stretch" |
35 | | - Panel.ZIndex="1" |
36 | | - wpf:ElevationAssist.Elevation="{TemplateBinding wpf:ElevationAssist.Elevation}" |
37 | | - Background="{TemplateBinding wpf:ColorZoneAssist.Background}" |
38 | | - DockPanel.Dock="Top" |
39 | | - Focusable="False"> |
40 | | - <ScrollViewer wpf:ScrollViewerAssist.BubbleVerticalScroll="True" |
41 | | - wpf:ScrollViewerAssist.SupportHorizontalScroll="True" |
| 34 | + VerticalAlignment="Stretch" |
| 35 | + Panel.ZIndex="1" |
| 36 | + wpf:ElevationAssist.Elevation="{TemplateBinding wpf:ElevationAssist.Elevation}" |
| 37 | + Background="{TemplateBinding wpf:ColorZoneAssist.Background}" |
| 38 | + DockPanel.Dock="Top" |
| 39 | + Focusable="False"> |
| 40 | + <Grid> |
| 41 | + <!-- Scrollable headers --> |
| 42 | + <ScrollViewer x:Name="PART_HeaderScrollViewer" |
| 43 | + wpf:ScrollViewerAssist.BubbleVerticalScroll="True" |
42 | 44 | wpf:ScrollViewerAssist.IgnorePadding="{Binding Path=(wpf:ScrollViewerAssist.IgnorePadding), RelativeSource={RelativeSource TemplatedParent}}" |
43 | 45 | wpf:ScrollViewerAssist.PaddingMode="{Binding Path=(wpf:ScrollViewerAssist.PaddingMode), RelativeSource={RelativeSource TemplatedParent}}" |
| 46 | + wpf:ScrollViewerAssist.SupportHorizontalScroll="True" |
44 | 47 | HorizontalScrollBarVisibility="Hidden" |
45 | 48 | VerticalScrollBarVisibility="Hidden"> |
46 | | - <StackPanel> |
47 | | - <UniformGrid x:Name="CenteredHeaderPanel" |
48 | | - HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 49 | + <StackPanel> |
| 50 | + <UniformGrid x:Name="CenteredHeaderPanel" |
49 | 51 | Margin="{Binding Path=(wpf:TabAssist.HeaderPanelMargin), RelativeSource={RelativeSource TemplatedParent}}" |
| 52 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
50 | 53 | VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
51 | 54 | wpf:TabAssist.BindableIsItemsHost="{Binding Visibility, RelativeSource={RelativeSource Self}}" |
52 | 55 | Focusable="False" |
53 | 56 | KeyboardNavigation.TabIndex="1" |
54 | 57 | Rows="1" /> |
55 | | - <VirtualizingStackPanel x:Name="HeaderPanel" |
56 | | - HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 58 | + <VirtualizingStackPanel x:Name="HeaderPanel" |
57 | 59 | Margin="{Binding Path=(wpf:TabAssist.HeaderPanelMargin), RelativeSource={RelativeSource TemplatedParent}}" |
| 60 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
58 | 61 | VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
59 | 62 | wpf:TabAssist.BindableIsItemsHost="{Binding Visibility, RelativeSource={RelativeSource Self}}" |
60 | 63 | Focusable="False" |
61 | 64 | KeyboardNavigation.TabIndex="1" |
62 | 65 | Orientation="Horizontal" /> |
63 | | - </StackPanel> |
64 | | - </ScrollViewer> |
| 66 | + </StackPanel> |
| 67 | + </ScrollViewer> |
| 68 | + |
| 69 | + <!-- Wrapping headers --> |
| 70 | + <ScrollViewer x:Name="PART_HeaderWrapScrollViewer" |
| 71 | + HorizontalScrollBarVisibility="Disabled" |
| 72 | + VerticalScrollBarVisibility="Auto" |
| 73 | + Visibility="Collapsed"> |
| 74 | + <WrapPanel x:Name="HeaderWrapPanel" |
| 75 | + Margin="{Binding Path=(wpf:TabAssist.HeaderPanelMargin), RelativeSource={RelativeSource TemplatedParent}}" |
| 76 | + Background="Transparent" |
| 77 | + IsItemsHost="True" |
| 78 | + KeyboardNavigation.TabIndex="1" /> |
| 79 | + </ScrollViewer> |
| 80 | + </Grid> |
65 | 81 | </wpf:ColorZone> |
66 | 82 | <Border x:Name="PART_BorderSelectedContent" |
67 | | - Padding="{TemplateBinding Padding}" |
68 | | - HorizontalAlignment="Stretch" |
69 | | - VerticalAlignment="Stretch" |
70 | | - Panel.ZIndex="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Panel.ZIndex)}" |
71 | | - Background="{x:Null}" |
72 | | - Focusable="False"> |
| 83 | + Padding="{TemplateBinding Padding}" |
| 84 | + HorizontalAlignment="Stretch" |
| 85 | + VerticalAlignment="Stretch" |
| 86 | + Panel.ZIndex="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Panel.ZIndex)}" |
| 87 | + Background="{x:Null}" |
| 88 | + Focusable="False"> |
73 | 89 | <ContentPresenter x:Name="PART_SelectedContentHost" |
74 | | - Margin="{TemplateBinding Padding}" |
75 | | - ContentSource="SelectedContent" |
76 | | - ContentStringFormat="{TemplateBinding SelectedContentStringFormat}" |
77 | | - ContentTemplate="{TemplateBinding SelectedContentTemplate}" |
78 | | - ContentTemplateSelector="{TemplateBinding SelectedContentTemplateSelector}" |
79 | | - Focusable="False" |
80 | | - SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> |
| 90 | + Margin="{TemplateBinding Padding}" |
| 91 | + ContentSource="SelectedContent" |
| 92 | + ContentStringFormat="{TemplateBinding SelectedContentStringFormat}" |
| 93 | + ContentTemplate="{TemplateBinding SelectedContentTemplate}" |
| 94 | + ContentTemplateSelector="{TemplateBinding SelectedContentTemplateSelector}" |
| 95 | + Focusable="False" |
| 96 | + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> |
81 | 97 | </Border> |
82 | 98 | </DockPanel> |
83 | 99 |
|
84 | 100 | <ControlTemplate.Triggers> |
| 101 | + |
| 102 | + <Trigger Property="wpf:TabAssist.HeaderBehavior" Value="Scrolling"> |
| 103 | + <Setter TargetName="PART_HeaderScrollViewer" Property="Visibility" Value="Visible"/> |
| 104 | + <Setter TargetName="PART_HeaderWrapScrollViewer" Property="Visibility" Value="Collapsed"/> |
| 105 | + </Trigger> |
| 106 | + <Trigger Property="wpf:TabAssist.HeaderBehavior" Value="Wrapping"> |
| 107 | + <Setter TargetName="PART_HeaderScrollViewer" Property="Visibility" Value="Collapsed"/> |
| 108 | + <Setter TargetName="PART_HeaderWrapScrollViewer" Property="Visibility" Value="Visible"/> |
| 109 | + </Trigger> |
| 110 | + |
85 | 111 | <Trigger Property="HorizontalContentAlignment" Value="Stretch"> |
86 | 112 | <Setter TargetName="CenteredHeaderPanel" Property="Visibility" Value="Visible" /> |
87 | 113 | <Setter TargetName="HeaderPanel" Property="Visibility" Value="Collapsed" /> |
|
0 commit comments