用blend打开TabItem模板。去掉border的margin。去掉一些不必要的trigger值。调整下tabitem的padding属性使得留余地给三角。
假设
<Setter Property="Padding" Value="6,1,6,10"/>
然后在Grid里面加一个Pah
<Grid SnapsToDevicePixels="true">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
<ContentPresenter x:Name="Content" ContentSource="Header" HorizontalAlignment="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
</Border>
<Path x:Name="triPath" Data="M49,34 L56.5,16.5 64.5,33.5" Fill="blue" Visibility="Collapsed" HorizontalAlignment="center" Stretch="Fill" Stroke="Black" Width="20" Height="10" VerticalAlignment="Bottom"/>
</Grid>
最后在<Trigger Property="IsSelected" Value="true">里加
<Setter Property="Visibility" TargetName="triPath" Value="Visible"/>
换行原理是tabcontrl模板中用来放置Header的Panel是一个折行panel(类似于Wrappanel)你需要换这个panel的模板即可。你可以自己用blend打开tabcontrl模板进行更改或者网上查下资源直接套用。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)