123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228 |
- <ResourceDictionary
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:cus="clr-namespace:PDF_Office.CustomControl">
- <Style x:Key="TabControlWithUnderLineStyle" TargetType="{x:Type TabControl}">
- <Setter Property="Padding" Value="2" />
- <Setter Property="HorizontalContentAlignment" Value="Center" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="BorderBrush" Value="#FFACACAC" />
- <Setter Property="BorderThickness" Value="0,0,0,1" />
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type TabControl}">
- <Grid
- x:Name="templateRoot"
- ClipToBounds="True"
- KeyboardNavigation.TabNavigation="Local"
- SnapsToDevicePixels="True">
- <Grid.ColumnDefinitions>
- <ColumnDefinition x:Name="ColumnDefinition0" />
- <ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition x:Name="RowDefinition0" Height="Auto" />
- <RowDefinition x:Name="RowDefinition1" Height="*" />
- </Grid.RowDefinitions>
- <!-- 加滑轨配合滑轨样式可实现箭头左右滚动的菜单栏 -->
- <!--<ScrollViewer Margin="140 0 140 0" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">-->
- <TabPanel
- x:Name="HeaderPanel"
- Grid.Row="0"
- Grid.Column="0"
- HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
- VerticalAlignment="{TemplateBinding VerticalAlignment}"
- Panel.ZIndex="1"
- Background="Transparent"
- IsItemsHost="True"
- KeyboardNavigation.TabIndex="1" />
- <!--</ScrollViewer>-->
- <!-- 页头和中间内容的分割线 -->
- <Line
- Margin="0,0,0,1"
- VerticalAlignment="Bottom"
- SnapsToDevicePixels="True"
- Stroke="#E7E9EC"
- StrokeThickness="0"
- X1="0"
- X2="{Binding ActualWidth, RelativeSource={RelativeSource Self}}" />
- <Border
- x:Name="ContentPanel"
- Grid.Row="1"
- Grid.Column="0"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- KeyboardNavigation.DirectionalNavigation="Contained"
- KeyboardNavigation.TabIndex="2"
- KeyboardNavigation.TabNavigation="Local">
- <ContentPresenter
- x:Name="PART_SelectedContentHost"
- Margin="0"
- VerticalAlignment="Stretch"
- Content="{TemplateBinding SelectedContent}"
- ContentSource="SelectedContent"
- ContentStringFormat="{TemplateBinding SelectedContentStringFormat}"
- ContentTemplate="{TemplateBinding SelectedContentTemplate}"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Border>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="TabStripPlacement" Value="Bottom">
- <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="1" />
- <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
- <Setter TargetName="RowDefinition1" Property="Height" Value="Auto" />
- </Trigger>
- <Trigger Property="TabStripPlacement" Value="Left">
- <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="0" />
- <Setter TargetName="ContentPanel" Property="Grid.Column" Value="1" />
- <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
- <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
- <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
- <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
- <Setter TargetName="HeaderPanel" Property="VerticalAlignment" Value="Top" />
- </Trigger>
- <Trigger Property="TabStripPlacement" Value="Right">
- <Setter TargetName="HeaderPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
- <Setter TargetName="HeaderPanel" Property="Grid.Column" Value="1" />
- <Setter TargetName="ContentPanel" Property="Grid.Column" Value="0" />
- <Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
- <Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
- <Setter TargetName="RowDefinition0" Property="Height" Value="*" />
- <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="False">
- <Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="KeyboardNavigation.DirectionalNavigation" Value="Cycle" />
- <Setter Property="KeyboardNavigation.TabNavigation" Value="Cycle" />
- </Style>
- <Style x:Key="TabItem_WithUnderLineStyle" TargetType="{x:Type cus:IconAndTextTabItem}">
- <Setter Property="Foreground" Value="Black" />
- <Setter Property="Background" Value="White" />
- <Setter Property="BorderBrush" Value="#FFACACAC" />
- <Setter Property="HorizontalContentAlignment" Value="Stretch" />
- <Setter Property="VerticalContentAlignment" Value="Stretch" />
- <Setter Property="AllowDrop" Value="True" />
- <Setter Property="SelectedForeground" Value="Black" />
- <Setter Property="FontSize" Value="14" />
- <Setter Property="Height" Value="40" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type cus:IconAndTextTabItem}">
- <Grid
- x:Name="templateRoot"
- Margin="{TemplateBinding Padding}"
- Background="Transparent"
- SnapsToDevicePixels="True">
- <Border
- x:Name="_underline"
- HorizontalAlignment="Stretch"
- BorderBrush="#FF477EDE"
- BorderThickness="0" />
- <StackPanel Orientation="Horizontal">
- <Path
- x:Name="NormalPathIcon"
- MaxWidth="20"
- MaxHeight="20"
- Margin="0,0,4,0"
- Data="{Binding NormalPathIcon, RelativeSource={RelativeSource Mode=TemplatedParent}}"
- Fill="Black"
- Visibility="Visible" />
- <Image
- x:Name="SelectedIcon"
- MaxWidth="20"
- MaxHeight=" 20"
- Margin="0,0,4,0"
- Source="{Binding SelectedIcon, RelativeSource={RelativeSource Mode=TemplatedParent}}"
- Visibility="Collapsed" />
- <TextBlock
- x:Name="txt"
- Margin="0,0,4,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="{TemplateBinding Foreground}"
- Text="{TemplateBinding Header}"
- TextTrimming="CharacterEllipsis"
- ToolTip="{TemplateBinding Header}"
- Visibility="Visible" />
- </StackPanel>
- </Grid>
- <ControlTemplate.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
- <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
- </MultiDataTrigger.Conditions>
- <Setter TargetName="SelectedIcon" Property="Visibility" Value="Collapsed" />
- <Setter TargetName="NormalPathIcon" Property="Visibility" Value="Visible" />
- <Setter TargetName="txt" Property="Foreground" Value="#FF000000" />
- </MultiDataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
- <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Left" />
- </MultiDataTrigger.Conditions>
- <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
- </MultiDataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
- <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Bottom" />
- </MultiDataTrigger.Conditions>
- <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
- </MultiDataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
- <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Right" />
- </MultiDataTrigger.Conditions>
- <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
- </MultiDataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
- <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
- </MultiDataTrigger.Conditions>
- <Setter TargetName="templateRoot" Property="Opacity" Value="0.56" />
- </MultiDataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="false" />
- <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
- </MultiDataTrigger.Conditions>
- <Setter TargetName="NormalPathIcon" Property="Opacity" Value="0.56" />
- </MultiDataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true" />
- <Condition Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type TabControl}}}" Value="Top" />
- </MultiDataTrigger.Conditions>
- <Setter Property="Panel.ZIndex" Value="1" />
- <Setter TargetName="txt" Property="Foreground" Value="{Binding SelectedForeground, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
- <Setter TargetName="_underline" Property="BorderThickness" Value="0,0,0,2" />
- <Setter TargetName="SelectedIcon" Property="Visibility" Value="Collapsed" />
- <Setter TargetName="NormalPathIcon" Property="Visibility" Value="Visible" />
- </MultiDataTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|