• WPF 模拟迅雷TabControl界面


    WPF模拟迅雷TabControl界面

    点击查看下载

      

    <!--TabControl样式-->
        <Style x:Key="TabControlStyle" TargetType="{x:Type TabControl}">
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="Padding" Value="4,4,4,4"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="{StaticResource TabControlNormalBorderBrush}"/>
            <Setter Property="Background" Value="#F9F9F9"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabControl}">
                        <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition x:Name="ColumnDefinition0" Width="0.192*" />
                                <ColumnDefinition x:Name="ColumnDefinition1" Width="0.808*"/>
                            </Grid.ColumnDefinitions>
                            <Border x:Name="ContentPanel" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="1" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="0" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local" Grid.ColumnSpan="1" Grid.RowSpan="1" Width="Auto" Margin="0">
                                <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Width="Auto" Margin="0"/>
                            </Border>
                            <StackPanel x:Name="HeaderPanel" Margin="0" IsItemsHost="True">
                                <StackPanel.Background>
                                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                        <GradientStop Color="#7AFFFFFF" Offset="0"/>
                                        <GradientStop Color="#42F0FCFF" Offset="1"/>
                                    </LinearGradientBrush>
                                </StackPanel.Background>
                            </StackPanel>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="listTabItemStyle" TargetType="{x:Type TabItem}">
            <Setter Property="FocusVisualStyle" Value="{StaticResource TabItemFocusVisual}"/>
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="Padding" Value="6,1,6,1"/>
            <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" Margin="0">
                            <Border x:Name="Bd" BorderThickness="0" Background="{x:Null}">
                                <TextBlock x:Name="textBlock" HorizontalAlignment="Stretch" Margin="58.75,0,0,0" TextWrapping="Wrap" VerticalAlignment="Center" Text="{TemplateBinding Header}"/>
                            </Border>
                            <Path x:Name="path" Data="M87.399999,0 L174.8,44.596669 L-5.0876247E-07,44.596669 z" Fill="White" Height="Auto" Margin="0,9.667,-1.583,9.667" Stretch="Fill" StrokeThickness="0" Width="11.466" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Stretch" HorizontalAlignment="Right" Visibility="Hidden">
                                <Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform Angle="-90"/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Path.RenderTransform>
                            </Path>
                            <Rectangle x:Name="rectangle" Margin="27,2.25,0,2.75" StrokeThickness="0" HorizontalAlignment="Left" Width="22.25" Fill="{TemplateBinding Background}"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsMouseOver" Value="True"/>
                                    <Condition Property="Selector.IsSelected" Value="False"/>
                                </MultiTrigger.Conditions>
                                <Setter
                            Property="CornerRadius" TargetName="Bd" Value="3"/>
                                <Setter
                            Property="BorderBrush" TargetName="Bd" Value="#562C94AF"/>
                                <Setter
                            Property="Margin" TargetName="Bd" Value="1"/>
                                <Setter
                            Property="BorderThickness" TargetName="Bd" Value="1"/>
                                <Setter
                            Property="Background" TargetName="Bd">
                                    <Setter.Value
                            >
                                        <LinearGradientBrush
                            EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop
                            Color="#2690D9FF" Offset="1"/>
                                            <GradientStop
                            Color="#47FFFFFF" Offset="0"/>
                                        </LinearGradientBrush>
                                    </Setter.Value>
                                </Setter>
                            </MultiTrigger>
                            <Trigger Property="IsSelected" Value="true">
                                <Setter Property="Panel.ZIndex" Value="1"/>
                                <Setter Property="Background" TargetName="Bd">
                                    <Setter.Value>
                                        <RadialGradientBrush RadiusX="0.641" RadiusY="1.243">
                                            <GradientStop Color="#FF6D9EC4" Offset="1"/>
                                            <GradientStop Color="#FFD4E0EB" Offset="0"/>
                                        </RadialGradientBrush>
                                    </Setter.Value>
                                </Setter>
                                <Setter Property="Visibility" TargetName="path" Value="Visible"/>
                                <Setter Property="Foreground" TargetName="textBlock" Value="White"/>
                            </Trigger>
                            <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>
    View Code

    转载:http://blog.csdn.net/cmis7645/article/details/7566813

  • 相关阅读:
    vue3.0+vite 使用 postcsspxtorem 实现移动自适应
    eltable 统计行放在最前面
    RN入门到进阶,打造高质量上线App(2022全新升级)
    elementUI eltable添加fixed后样式异常
    eltable大数据量渲染卡顿的解决方案
    Asp.net core IdentityServer4与传统基于角色的权限系统的集成
    LeetCode 小水题选做(更新中)
    洛谷P8096 「USACO 2022.1 Gold」Drought
    CF1647F Madoka and Laziness
    LOJ3664 「JOI 2022 Final」选举
  • 原文地址:https://www.cnblogs.com/tianciliangen/p/7028463.html
Copyright © 2020-2023  润新知