Skip to content

Commit 484f8bf

Browse files
committed
Fix Issue (#113)
Fix Issue (#113)
1 parent 2f86b56 commit 484f8bf

File tree

1 file changed

+13
-90
lines changed

1 file changed

+13
-90
lines changed

src/WPFDevelopers.Shared/Styles/Styles.TabControl.xaml

Lines changed: 13 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,14 @@
2020
<Setter.Value>
2121
<ControlTemplate TargetType="{x:Type TabItem}">
2222
<controls:SmallPanel Background="{TemplateBinding Background}">
23-
<Border
24-
x:Name="PART_Border"
25-
BorderThickness="{TemplateBinding BorderThickness}"
26-
RenderTransformOrigin=".5,.5">
27-
<Border.RenderTransform>
28-
<ScaleTransform ScaleX="0" ScaleY="1" />
29-
</Border.RenderTransform>
30-
</Border>
23+
<Border x:Name="PART_Border" BorderThickness="{TemplateBinding BorderThickness}" />
3124
<ContentPresenter
3225
x:Name="PART_ContentPresenter"
3326
Margin="{TemplateBinding Padding}"
3427
HorizontalAlignment="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
3528
VerticalAlignment="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
3629
ContentSource="Header"
3730
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
38-
<VisualStateManager.VisualStateGroups>
39-
<VisualStateGroup x:Name="SelectionStates">
40-
<VisualState x:Name="Unselected" />
41-
<VisualState x:Name="Selected">
42-
<Storyboard>
43-
<DoubleAnimation
44-
Storyboard.TargetName="PART_Border"
45-
Storyboard.TargetProperty="(Border.RenderTransform).(ScaleTransform.ScaleX)"
46-
To="1"
47-
Duration="00:00:.2" />
48-
</Storyboard>
49-
</VisualState>
50-
</VisualStateGroup>
51-
</VisualStateManager.VisualStateGroups>
5231
</controls:SmallPanel>
5332
<ControlTemplate.Triggers>
5433
<Trigger Property="IsSelected" Value="True">
@@ -65,74 +44,15 @@
6544
</Setter>
6645
</Style>
6746

68-
<Style
69-
x:Key="WD.BaseLAndRTabItem"
70-
BasedOn="{StaticResource WD.ControlBasicStyle}"
71-
TargetType="{x:Type TabItem}">
72-
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
73-
<Setter Property="VerticalContentAlignment" Value="Stretch" />
74-
<Setter Property="Background" Value="Transparent" />
75-
<Setter Property="Padding" Value="{StaticResource WD.DefaultPadding}" />
76-
<Setter Property="BorderThickness" Value="{StaticResource WD.TabItemBorderThickness}" />
77-
<Setter Property="HorizontalContentAlignment" Value="Center" />
78-
<Setter Property="VerticalContentAlignment" Value="Center" />
79-
<Setter Property="Template">
80-
<Setter.Value>
81-
<ControlTemplate TargetType="{x:Type TabItem}">
82-
<controls:SmallPanel Background="{TemplateBinding Background}">
83-
<Border
84-
x:Name="PART_Border"
85-
BorderThickness="{TemplateBinding BorderThickness}"
86-
RenderTransformOrigin=".5,.5">
87-
<Border.RenderTransform>
88-
<ScaleTransform ScaleX="1" ScaleY="0" />
89-
</Border.RenderTransform>
90-
</Border>
91-
<ContentPresenter
92-
x:Name="PART_ContentPresenter"
93-
Margin="{TemplateBinding Padding}"
94-
HorizontalAlignment="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
95-
VerticalAlignment="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"
96-
ContentSource="Header"
97-
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
98-
<VisualStateManager.VisualStateGroups>
99-
<VisualStateGroup x:Name="SelectionStates">
100-
<VisualState x:Name="Unselected" />
101-
<VisualState x:Name="Selected">
102-
<Storyboard>
103-
<DoubleAnimation
104-
Storyboard.TargetName="PART_Border"
105-
Storyboard.TargetProperty="(Border.RenderTransform).(ScaleTransform.ScaleY)"
106-
To="1"
107-
Duration="00:00:.2" />
108-
</Storyboard>
109-
</VisualState>
110-
</VisualStateGroup>
111-
</VisualStateManager.VisualStateGroups>
112-
</controls:SmallPanel>
113-
<ControlTemplate.Triggers>
114-
<Trigger Property="IsSelected" Value="True">
115-
<Setter TargetName="PART_Border" Property="BorderBrush" Value="{DynamicResource WD.PrimaryNormalSolidColorBrush}" />
116-
<Setter Property="Background" Value="{DynamicResource WD.DefaultBackgroundSolidColorBrush}" />
117-
<Setter TargetName="PART_ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource WD.PrimaryNormalSolidColorBrush}" />
118-
</Trigger>
119-
<Trigger Property="IsMouseOver" Value="True">
120-
<Setter TargetName="PART_ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource WD.PrimaryNormalSolidColorBrush}" />
121-
</Trigger>
122-
</ControlTemplate.Triggers>
123-
</ControlTemplate>
124-
</Setter.Value>
125-
</Setter>
126-
</Style>
12747
<Style
12848
x:Key="WD.LeftTabItem"
129-
BasedOn="{StaticResource WD.BaseLAndRTabItem}"
49+
BasedOn="{StaticResource WD.BaseTAndBTabItem}"
13050
TargetType="{x:Type TabItem}">
13151
<Setter Property="BorderThickness" Value="0,0,2,0" />
13252
</Style>
13353
<Style
13454
x:Key="WD.RightTabItem"
135-
BasedOn="{StaticResource WD.BaseLAndRTabItem}"
55+
BasedOn="{StaticResource WD.BaseTAndBTabItem}"
13656
TargetType="{x:Type TabItem}">
13757
<Setter Property="BorderThickness" Value="2,0,0,0" />
13858
</Style>
@@ -170,14 +90,17 @@
17090
BorderBrush="{TemplateBinding BorderBrush}"
17191
BorderThickness="{TemplateBinding BorderThickness}"
17292
CornerRadius="{Binding Path=(helpers:ElementHelper.CornerRadius), RelativeSource={RelativeSource TemplatedParent}}">
173-
<Grid Clip="{Binding RelativeSource={RelativeSource AncestorType=controls:WDBorder}, Path=ContentClip}">
93+
<Grid
94+
Clip="{Binding RelativeSource={RelativeSource AncestorType=controls:WDBorder}, Path=ContentClip}"
95+
KeyboardNavigation.TabNavigation="Local"
96+
SnapsToDevicePixels="True">
17497
<Grid.ColumnDefinitions>
175-
<ColumnDefinition Name="ColumnDefinition0" />
176-
<ColumnDefinition Name="ColumnDefinition1" Width="0" />
98+
<ColumnDefinition x:Name="ColumnDefinition0" />
99+
<ColumnDefinition x:Name="ColumnDefinition1" Width="0" />
177100
</Grid.ColumnDefinitions>
178101
<Grid.RowDefinitions>
179-
<RowDefinition Name="RowDefinition0" Height="Auto" />
180-
<RowDefinition Name="RowDefinition1" Height="*" />
102+
<RowDefinition x:Name="RowDefinition0" Height="Auto" />
103+
<RowDefinition x:Name="RowDefinition1" Height="*" />
181104
</Grid.RowDefinitions>
182105
<Border
183106
x:Name="HeaderBorder"
@@ -223,10 +146,10 @@
223146
<Setter Property="ItemContainerStyle" Value="{StaticResource WD.BottomTabItem}" />
224147
</Trigger>
225148
<Trigger Property="TabControl.TabStripPlacement" Value="Left">
226-
<Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
227-
<Setter TargetName="ContentPanel" Property="Grid.Column" Value="1" />
228149
<Setter TargetName="ColumnDefinition0" Property="ColumnDefinition.Width" Value="Auto" />
229150
<Setter TargetName="ColumnDefinition1" Property="ColumnDefinition.Width" Value="*" />
151+
<Setter TargetName="ContentPanel" Property="Grid.Row" Value="0" />
152+
<Setter TargetName="ContentPanel" Property="Grid.Column" Value="1" />
230153
<Setter TargetName="RowDefinition0" Property="RowDefinition.Height" Value="*" />
231154
<Setter TargetName="RowDefinition1" Property="RowDefinition.Height" Value="0" />
232155
<Setter TargetName="HeaderBorder" Property="BorderThickness" Value="0,0,1,0" />

0 commit comments

Comments
 (0)