我在 TabItem 内有一个 Stackpanel,它是 TabControl 的一部分。随着东西被添加到 StackPanel,我有一个自定义的垂直 ScrollBar 出现。目前,它出现在“堆栈面板顶部”的 TabItem 控件内。我想将滚动条的位置完全移到 TabControl 之外。我试图用边距做一些事情,但是当 ScrollBar 被推到 TabControl 的边缘之外时,它只是被剪掉了,我再多的弄乱 zindex 都没有导致任何成功。任何帮助将不胜感激。- 莱夫
<TabItem Name="tabItem1" Background="{x:Null}" BorderBrush="#FF48D6EE" IsSelected="True">
<TabItem.Template>
<ControlTemplate TargetType="{x:Type TabItem}">
<Grid>
<Border Name="Tab1" Margin="0,0,0,0" BorderBrush="#FF002648" BorderThickness="1,0,1,1" CornerRadius="0,0,3,3">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" Color="#FF3Ed3F4" Opacity=".5" BlurRadius="2"/>
</Border.Effect>
</Border>
<HeaderedContentControl Name="TabHeaderText"
TextBlock.FontFamily="Aharoni"
TextBlock.FontWeight="Bold"
TextBlock.Foreground="#FF214c6d"
TextBlock.FontSize="18"
Header="Tab1"
Margin="10,1,10,0"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Tab1" Property="Background">
<Setter.Value>
<LinearGradientBrush StartPoint=".5,0" EndPoint=".5,1">
<GradientStop Color="#FF000a13" Offset="0" />
<GradientStop Color="#FF06335c" Offset="0.5" />
<GradientStop Color="#FF33bbdb" Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter TargetName="Tab1" Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="0" Color="#FF3ccbee" Opacity="1" BlurRadius="5"/>
</Setter.Value>
</Setter>
<Setter TargetName="Tab1" Property="BorderBrush" Value="#FF48d6ed"/>
<Setter TargetName="Tab1" Property="BorderThickness" Value="1,0,1,1" />
<Setter TargetName="Tab1" Property="Header">
<Setter.Value>
<custom:OutlinedText FontSize="18"
FontFamily="Aharoni"
FontWeight="ExtraBold"
Fill="Black"
Stroke="#ff3bb1db"
StrokeThickness=".75"
Text="Tab1"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</TabItem.Template>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
Template="{StaticResource ScrollViewerControlTemplate}">
<StackPanel Name="panelTab1" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</ScrollViewer>
</TabItem>