1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > WPF TabControl美化

WPF TabControl美化

时间:2022-01-24 01:03:02

相关推荐

WPF TabControl美化

实现效果

XMAL样式

<Window.Resources><!-- TabItem的样式 --><Style TargetType="{x:Type TabItem}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type TabItem}"><Grid><!-- 主Border --><BorderName="bd"Cursor="Hand"Margin="2,3,2,3"Background="{TemplateBinding Background}"BorderBrush="Gray"BorderThickness=".5"CornerRadius="7"><ContentPresenterMargin="10,5"VerticalAlignment="Center"ContentSource="Header" /></Border></Grid><ControlTemplate.Triggers><Trigger Property="IsSelected" Value="True"><Setter TargetName="bd" Property="BorderThickness" Value="1" /><Setter TargetName="bd" Property="Margin" Value="0" /></Trigger><Trigger Property="IsMouseOver" Value="True" /></ControlTemplate.Triggers></ControlTemplate></Setter.Value></Setter><Setter Property="Foreground" Value="Black" /><Setter Property="FontSize" Value="12" /></Style><!-- TabControl的样式 --><Style TargetType="{x:Type TabControl}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type TabControl}"><Grid><Grid.RowDefinitions><RowDefinition Height="Auto" /><RowDefinition Height="*" /></Grid.RowDefinitions><Border Padding="10"><TabPanel IsItemsHost="True" /></Border><BorderGrid.Row="1"Padding="10"BorderBrush="Gray"BorderThickness="2"><ContentPresenter Name="PART_SelectedContentHost" ContentSource="SelectedContent" /></Border></Grid></ControlTemplate></Setter.Value></Setter></Style><!--#endregion--></Window.Resources>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。