Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 205306f

Browse files
committed
Move TabControl styles out of PR Creation view
1 parent d4bf121 commit 205306f

File tree

4 files changed

+113
-160
lines changed

4 files changed

+113
-160
lines changed

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@
371371
<SubType>Designer</SubType>
372372
<Generator>MSBuild:Compile</Generator>
373373
</Page>
374+
<Page Include="Styles\GitHubTabControl.xaml">
375+
<SubType>Designer</SubType>
376+
<Generator>MSBuild:Compile</Generator>
377+
</Page>
374378
<Page Include="Styles\ThemeBlue.xaml">
375379
<Generator>MSBuild:Compile</Generator>
376380
<SubType>Designer</SubType>

src/GitHub.VisualStudio/SharedDictionary.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/Styles/ActionLinkButton.xaml" />
1010
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/Styles/GitHubComboBox.xaml" />
1111
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/Styles/Buttons.xaml" />
12+
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/Styles/GitHubTabControl.xaml" />
1213
</ResourceDictionary.MergedDictionaries>
1314

1415
<Style x:Key="VSStyledButton" BasedOn="{StaticResource VsButtonStyleKey}" TargetType="{x:Type Button}" />
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:local="clr-namespace:GitHub.VisualStudio.Styles">
4+
5+
<Style x:Key="GitHubPRDetailsTabControl" TargetType="{x:Type TabControl}">
6+
<Setter Property="Padding" Value="0,5" />
7+
<Setter Property="HorizontalContentAlignment" Value="Center"/>
8+
<Setter Property="VerticalContentAlignment" Value="Center"/>
9+
<Setter Property="Background" Value="{DynamicResource GitHubVsToolWindowBackground}"/>
10+
<Setter Property="BorderBrush" Value="{DynamicResource GitHubTabItemSelectedBorder}"/>
11+
<Setter Property="BorderThickness" Value="0,1,0,0"/>
12+
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
13+
<Setter Property="Template">
14+
<Setter.Value>
15+
<ControlTemplate TargetType="{x:Type TabControl}">
16+
<Grid x:Name="templateRoot" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
17+
<Grid.ColumnDefinitions>
18+
<ColumnDefinition x:Name="ColumnDefinition0"/>
19+
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
20+
</Grid.ColumnDefinitions>
21+
<Grid.RowDefinitions>
22+
<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
23+
<RowDefinition x:Name="RowDefinition1" Height="*"/>
24+
</Grid.RowDefinitions>
25+
<TabPanel x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="2,2,2,-1" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
26+
<Border x:Name="contentPanel" BorderBrush="{TemplateBinding BorderBrush}"
27+
BorderThickness="{TemplateBinding BorderThickness}"
28+
Background="{TemplateBinding Background}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
29+
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
30+
</Border>
31+
</Grid>
32+
<ControlTemplate.Triggers>
33+
<Trigger Property="TabStripPlacement" Value="Bottom">
34+
<Setter Property="Grid.Row" TargetName="headerPanel" Value="1"/>
35+
<Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
36+
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
37+
<Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
38+
<Setter Property="Margin" TargetName="headerPanel" Value="2,0,2,2"/>
39+
</Trigger>
40+
<Trigger Property="TabStripPlacement" Value="Left">
41+
<Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
42+
<Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
43+
<Setter Property="Grid.Column" TargetName="headerPanel" Value="0"/>
44+
<Setter Property="Grid.Column" TargetName="contentPanel" Value="1"/>
45+
<Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
46+
<Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
47+
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
48+
<Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
49+
<Setter Property="Margin" TargetName="headerPanel" Value="2,2,0,2"/>
50+
</Trigger>
51+
<Trigger Property="TabStripPlacement" Value="Right">
52+
<Setter Property="Grid.Row" TargetName="headerPanel" Value="0"/>
53+
<Setter Property="Grid.Row" TargetName="contentPanel" Value="0"/>
54+
<Setter Property="Grid.Column" TargetName="headerPanel" Value="1"/>
55+
<Setter Property="Grid.Column" TargetName="contentPanel" Value="0"/>
56+
<Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
57+
<Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
58+
<Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
59+
<Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
60+
<Setter Property="Margin" TargetName="headerPanel" Value="0,2,2,2"/>
61+
</Trigger>
62+
<Trigger Property="IsEnabled" Value="false">
63+
<Setter Property="TextElement.Foreground" TargetName="templateRoot" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
64+
</Trigger>
65+
</ControlTemplate.Triggers>
66+
</ControlTemplate>
67+
</Setter.Value>
68+
</Setter>
69+
</Style>
70+
71+
<Style x:Key="GitHubPRDetailsTabItem" TargetType="{x:Type TabItem}">
72+
<Setter Property="FocusVisualStyle" Value="{StaticResource NoMarginFocusVisual}" />
73+
<Setter Property="Width" Value="Auto" />
74+
<Setter Property="Template">
75+
<Setter.Value>
76+
<ControlTemplate TargetType="{x:Type TabItem}">
77+
<Border Name="Border" CornerRadius="2,2,0,0"
78+
BorderThickness="1,1,1,0"
79+
Padding="10,5">
80+
<DockPanel HorizontalAlignment="Center">
81+
<TextBlock
82+
x:Name="ContentSite"
83+
FontSize="12"
84+
VerticalAlignment="Center"
85+
Text="{TemplateBinding Header}" />
86+
</DockPanel>
87+
</Border>
88+
89+
<ControlTemplate.Triggers>
90+
<Trigger Property="IsSelected" Value="True">
91+
<Setter TargetName="Border" Property="Background" Value="{DynamicResource GitHubVsToolWindowBackground}" />
92+
<Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource GitHubTabItemSelectedBorder}" />
93+
<Setter TargetName="ContentSite" Property="Foreground" Value="{DynamicResource GitHubVsToolWindowText}" />
94+
</Trigger>
95+
96+
<Trigger Property="IsSelected" Value="False">
97+
<Setter TargetName="ContentSite" Property="Foreground" Value="{DynamicResource GitHubVsGrayText}" />
98+
</Trigger>
99+
100+
<Trigger Property="IsMouseOver" Value="True">
101+
<Setter TargetName="ContentSite" Property="Foreground" Value="{DynamicResource GitHubVsWindowText}" />
102+
</Trigger>
103+
</ControlTemplate.Triggers>
104+
</ControlTemplate>
105+
</Setter.Value>
106+
</Setter>
107+
</Style>
108+
</ResourceDictionary>

0 commit comments

Comments
 (0)