WPF TabControl
一、WPF TabControl 数据绑定
WPF TabItem绑定
参考:http://cn.voidcc.com/question/p-qqyuxlvm-ex.html
WPF如何绑定tabitem与列表
参考:http://cn.voidcc.com/question/p-faompnxo-qd.html
WPF TabControl 绑定生成TabItem与TabItem里的数据
参考:https://blog.csdn.net/lovezhong1993/article/details/100299352
【WPF】TabControl垂直分页栏/选项卡
https://www.cnblogs.com/guxin/p/7128993.html
WPF实现纵向显示TabControl标题及标题字体样式
https://blog.csdn.net/dnazhd/article/details/89841942
通过 Style 设置
<TabControl Style="{StaticResource TabControlConsumeStyle}"> <TabItem Header="消费日榜" Style="{StaticResource TabItemConsumeStyle}"> //Code ... </TabItem> <TabItem Header="消费周榜" Style="{StaticResource TabItemConsumeStyle}"> //Code ... </TabItem> </TabControl>
Style
<Style x:Key="TabControlConsumeStyle" TargetType="TabControl"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TabControl}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="30"/> <RowDefinition/> </Grid.RowDefinitions> <!--TabControl.ItemTemplate--> <TabPanel Grid.Row="0" IsItemsHost="True" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/> <!--TabControl.ContentTemplate--> <ContentPresenter Grid.Row="1" ContentTemplate="{TemplateBinding SelectedContentTemplate}" Content="{TemplateBinding SelectedContent}" ContentStringFormat="{TemplateBinding SelectedContentStringFormat}" ContentSource="SelectedContent" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="TabItemConsumeStyle" TargetType="{x:Type TabItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type TabItem}"> <Border x:Name="border" Margin="10 0 0 0" Padding="10 0 10 0" BorderThickness="0 0 0 1" BorderBrush="Transparent"> <TextBlock x:Name="txt" Visibility="Visible" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{TemplateBinding Header}" ToolTip="{TemplateBinding Header}" Foreground="{TemplateBinding Foreground}" TextTrimming="CharacterEllipsis" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter TargetName="border" Property="BorderThickness" Value="0 0 0 1" /> <Setter TargetName="border" Property="BorderBrush" Value="#ff5d23" /> <Setter TargetName="txt" Property="Foreground" Value="#ff5d23"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>