A simple TabItem style ., Simple TabItem style.

Source: Internet
Author: User

A simple TabItem style ., Simple TabItem style.

Share a simple TabItem style used in previous projects.

As follows:

        <SolidColorBrush x:Key="TabItemDisabledBackground" Color="#F4F4F4"/>        <SolidColorBrush x:Key="TabItemDisabledBorderBrush" Color="#FFC9C7BA"/>        <Style  TargetType="{x:Type TabItem}">            <!--<Setter Property="FocusVisualStyle" Value="{x:null}"/>-->            <Setter Property="Foreground" Value="#333333"/>            <Setter Property="FontSize" Value="16"/>            <Setter Property="BorderBrush" Value="{StaticResource TabControlNormalBorderBrush}"/>            <Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>            <Setter Property="VerticalContentAlignment" Value="Stretch"/>            <Setter Property="Template">                <Setter.Value>                    <ControlTemplate TargetType="{x:Type TabItem}">                        <Grid SnapsToDevicePixels="true" Height="40" MinWidth="110">                            <Path Margin="0 0 0 -12" x:Name="PATH" Visibility="Collapsed" Data="M0.5,0.5 L109.5,0.5 109.5,39.5 64,40 57,51 49,40 0.5,39.5 z" Fill="#FF0FAF46"  Height="51.5"  Stretch="Fill" Stroke="Transparent"  Width="110"/>                            <Border x:Name="Bd" Background="#dfe9f6">                                <ContentPresenter Margin="5 0 5 0" 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>                        </Grid>                        <ControlTemplate.Triggers>                            <MultiTrigger>                                <MultiTrigger.Conditions>                                    <Condition Property="IsSelected" Value="true"/>                                    <Condition Property="TabStripPlacement" Value="Top"/>                                </MultiTrigger.Conditions>                                <Setter Property="Visibility" Value="visible" TargetName="PATH"/>                                <Setter Property="Foreground" Value="White"></Setter>                                <Setter Property="Background" Value="#FF0FAF46" TargetName="Bd"/>                            </MultiTrigger>                            <Trigger Property="IsEnabled" Value="false">                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource TabItemDisabledBackground}"/>                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource TabItemDisabledBorderBrush}"/>                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>                            </Trigger>                        </ControlTemplate.Triggers>                    </ControlTemplate>                </Setter.Value>            </Setter>        </Style>

Here, only the label direction is implemented in Top. Other animations or display effects can be added at will!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.