GraphTab.xaml 6.4 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
潘栩锋's avatar
潘栩锋 committed
3

潘栩锋's avatar
潘栩锋 committed
4 5 6 7 8 9 10 11 12
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    <ControlTemplate x:Key="GraphTab" TargetType="{x:Type TabControl}">
        <ControlTemplate.Resources>
            <Style TargetType="{x:Type TabItem}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
潘栩锋's avatar
潘栩锋 committed
13
                            <Grid SnapsToDevicePixels="True" >
潘栩锋's avatar
潘栩锋 committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup Name="CommonStates">
                                        <VisualState Name="MouseOver">
                                            <Storyboard>
                                                <ThicknessAnimation Storyboard.TargetName="buttonShape" 
                                                                 Storyboard.TargetProperty="Margin" To="0" Duration="0:0:.1"/>
                                                <ThicknessAnimation Storyboard.TargetName="buttonBackgroundShape" 
                                                                 Storyboard.TargetProperty="Margin" To="0" Duration="0:0:.1"/>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState Name="Normal">
                                            <Storyboard>
                                                <ThicknessAnimation Storyboard.TargetName="buttonShape" 
                                                                 Storyboard.TargetProperty="Margin" To="5" Duration="0:0:.1"/>
                                                <ThicknessAnimation Storyboard.TargetName="buttonBackgroundShape" 
                                                                 Storyboard.TargetProperty="Margin" To="5" 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"/>
潘栩锋's avatar
潘栩锋 committed
38

潘栩锋's avatar
潘栩锋 committed
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
                                                <DoubleAnimation Storyboard.TargetName="buttonBackgroundShape" Storyboard.TargetProperty="Opacity" 
                                                                 To="1" Duration="0"/>
                                                <!-- 
                                                <ColorAnimation Storyboard.TargetName="buttonText" 
                                                                Storyboard.TargetProperty= "(TextBlock.Foreground).(SolidColorBrush.Color)" 
                                                                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="buttonBackgroundShape" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.1"/>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Border Name="buttonBackgroundShape" Opacity="0" BorderThickness="0,2" Background="{StaticResource Color_theme_static}" Margin="5"/>
                                <Border Name="buttonShape" Opacity="0" BorderThickness="0,2" Background="{StaticResource Color_theme_activity}" Margin="5" />
潘栩锋's avatar
潘栩锋 committed
58

潘栩锋's avatar
潘栩锋 committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
                                <!--<ContentPresenter Name="buttonText" 
                                                  TextBlock.FontFamily="Calibri"
                                                  TextBlock.FontSize="12pt"
                                                  TextBlock.Foreground="White"
                                                  Margin="20"
                                                  Content="{TemplateBinding Header}"
                                                  VerticalAlignment="Center"/>-->
                                <TextBlock Name="buttonText" 
                                                  TextBlock.FontFamily="Calibri"
                                                  TextBlock.FontSize="12pt"
                                                  TextBlock.Foreground="White"
                                                  Margin="20"
                                                  Text="{TemplateBinding Header}"
                                                  VerticalAlignment="Center"/>
                            </Grid>
潘栩锋's avatar
潘栩锋 committed
74

潘栩锋's avatar
潘栩锋 committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ControlTemplate.Resources>
        <Grid SnapsToDevicePixels="True" >
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition/>
            </Grid.RowDefinitions>
            <StackPanel IsItemsHost="True" 
                        Orientation="Horizontal"
                        Margin="0,0,-1,0" />
            <ContentPresenter 
                Content="{TemplateBinding SelectedContent}" 
                Grid.Row="1" />
        </Grid>
    </ControlTemplate>
潘栩锋's avatar
潘栩锋 committed
93 94 95 96
    <Style TargetType="TabControl"  x:Key="GraphTabStyle">
        <Setter Property="Template" Value="{StaticResource GraphTab}"/>
    </Style>

潘栩锋's avatar
潘栩锋 committed
97
</ResourceDictionary>