Styles/TabControl.xaml

(开头部分) 29KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:WPFDemo"
                    xmlns:controls="clr-namespace:WPFDemo.Controls">
    <Style x:Key="TabControlStyle" TargetType="{x:Type TabControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabControl}">
                    <Grid Background="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border  BorderBrush="Transparent" BorderThickness="0 0 0 0">
                            <TabPanel IsItemsHost="True"/>
                        </Border>
                        <Border Grid.Row="1"
                                    BorderBrush="Transparent"
                                    Padding="0"
                                    BorderThickness="0" Background="{TemplateBinding Background}">
                            <ContentPresenter ContentSource="SelectedContent" Name="PART_SelectedContentHost"/>
                        </Border>
                    </Grid>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--TabControl-->
    <Style x:Key="TabItemStyle" TargetType="TabItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TabItem">
                    <Grid >
                        <Border x:Name="bd"
                                    Background="Transparent"
                                    Height="30"
                                    BorderBrush="Transparent"
                                    BorderThickness="0 0 0 0"
                                    CornerRadius="0,0,0,0"
                                    Margin="0">
                            <TextBlock x:Name="txt" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Header}" VerticalAlignment="Center" Margin="30 0"/>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="true">
                            <Setter TargetName="bd" Property="BorderThickness" Value="0,0,0,0" />
                            <Setter TargetName="bd" Property="BorderBrush" Value="Transparent" />
                            <Setter TargetName="bd" Property="Background" Value="#33ffffff" />
                            <!--<Setter TargetName="bd" Property="Background" Value="{StaticResource  defaultcolor}" />-->
                            <Setter TargetName="txt" Property="Foreground" Value="#fff"/>
                        </Trigger>
                        <!--<Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="txt" Property="Foreground" Value="{StaticResource defaultoverbg}"/>
                        </Trigger>-->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
后面还有 334 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。