OfficeTab.xaml 7.04 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ControlTemplate x:Key="OfficeTabControl" TargetType="{x:Type TabControl}">
        <ControlTemplate.Resources>
            <Style TargetType="{x:Type TabItem}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
                            <Grid >
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup Name="CommonStates">
                                        <VisualState Name="MouseOver">
                                            <Storyboard>
                                                <DoubleAnimation Storyboard.TargetName="hoverShape" 
                                                                 Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.1"/>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState Name="Normal">
                                            <Storyboard>
                                                <DoubleAnimation Storyboard.TargetName="hoverShape" 
                                                                 Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:.1"/>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup Name="SelectionStates">
                                        <VisualState Name="Selected">
                                            <Storyboard>
                                                <DoubleAnimation Storyboard.TargetName="buttonShape" Storyboard.TargetProperty="Opacity" 
                                                                 To="1" Duration="0:0:.3"/>
                                                <DoubleAnimation Storyboard.TargetName="hoverShape" Storyboard.TargetProperty="Opacity"
                                                                 To="0" Duration="0:0:.1"/>

                                                <DoubleAnimation Storyboard.TargetName="buttonBackgroundShape" Storyboard.TargetProperty="Opacity" 
                                                                 To="1" Duration="0"/>
                                                <!--
                                                <ColorAnimation Storyboard.TargetName="buttonText" 
                                                                Storyboard.TargetProperty= "TextBlock.Foreground" 
                                                                To="White" Duration="0:0:.1" />-->
                                                
                                            </Storyboard>

                                        </VisualState>
                                        <VisualState Name="Unselected">
                                            <Storyboard>
                                                <DoubleAnimation Storyboard.TargetName="buttonShape" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:.1"/>
                                                <DoubleAnimation Storyboard.TargetName="hoverShape" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:.1"/>

                                                <DoubleAnimation Storyboard.TargetName="buttonBackgroundShape" Storyboard.TargetProperty="Opacity" To="0" Duration="0"/>

                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>

                                <Border Name="hoverShape" Height="40" Margin="0,0,1,0" 
                                        SnapsToDevicePixels="True" 
                                        BorderThickness="1,0,1,1" 
                                        BorderBrush="LightGray">
                                </Border>
                                <Border Name="buttonBackgroundShape" BorderBrush="#FFA1B7EA" Opacity="0" 
                                            BorderThickness="0,1" Background="#FFE5EEF9" 
                                            Height="40" SnapsToDevicePixels="True" />
                                <Border Name="buttonShape" Opacity="0" 
                                        BorderBrush="#FF0343A6" 
                                        BorderThickness="0,2" 
                                        Height="40" 
                                        SnapsToDevicePixels="True">
                                    <Path Data="M214,108 L346,108 346.125,118.125 337.75,126.125 346.375,134 346.375,143.875 214.25,144.25 z" 
                                          SnapsToDevicePixels="True" Stretch="Fill" Height="40">
                                        <Path.Fill>
                                            <RadialGradientBrush GradientOrigin="0.2,0.5" RadiusX="0.8" RadiusY="0.8">
                                                <GradientStop Color="#FF5FA3F6" Offset="0" />
                                                <GradientStop Color="#FF0C55B9" Offset="1" />
                                            </RadialGradientBrush>

                                        </Path.Fill>

                                    </Path>
                                </Border>
                                
                                <ContentPresenter Name="buttonText" Margin="15,0,5,0" 
                                                  TextBlock.FontFamily="Calibri"
                                                  TextBlock.FontSize="12pt"
                                                  TextBlock.Foreground="Black"
                                                  Content="{TemplateBinding Header}"
                                                  VerticalAlignment="Center"/>

                            </Grid>

                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ControlTemplate.Resources>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="160" />
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Border Background="#FFE9ECEF" 
                    Grid.Column="0" 
                    BorderBrush="LightGray" 
                    BorderThickness="1" 
                    SnapsToDevicePixels="True" />
            <StackPanel IsItemsHost="True" 
                        Grid.Column="0" 
                        Margin="0,0,-1,0" 
                        SnapsToDevicePixels="True" />
            <ContentPresenter 
                Content="{TemplateBinding SelectedContent}" 
                Grid.Column="1" 
                Margin="0,0,0,0" />
        </Grid>
    </ControlTemplate>
</ResourceDictionary>