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

Commit b91c7b5

Browse files
committed
Move PromptTextBox styles and don't hardcode height
1 parent f9b2853 commit b91c7b5

File tree

4 files changed

+68
-58
lines changed

4 files changed

+68
-58
lines changed

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@
375375
<SubType>Designer</SubType>
376376
<Generator>MSBuild:Compile</Generator>
377377
</Page>
378+
<Page Include="Styles\TextBlocks.xaml">
379+
<SubType>Designer</SubType>
380+
<Generator>MSBuild:Compile</Generator>
381+
</Page>
378382
<Page Include="Styles\ThemeBlue.xaml">
379383
<Generator>MSBuild:Compile</Generator>
380384
<SubType>Designer</SubType>

src/GitHub.VisualStudio/SharedDictionary.xaml

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/Styles/GitHubComboBox.xaml" />
1212
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/Styles/Buttons.xaml" />
1313
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/Styles/GitHubTabControl.xaml" />
14+
<cache:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio;component/Styles/TextBlocks.xaml" />
1415
</ResourceDictionary.MergedDictionaries>
1516

1617
<Style x:Key="VSStyledButton" BasedOn="{StaticResource VsButtonStyleKey}" TargetType="{x:Type Button}" />
@@ -62,60 +63,4 @@
6263
</Setter.Value>
6364
</Setter>
6465
</Style>
65-
66-
<Style x:Key="GitHubVsPromptTextBox" TargetType="{x:Type ui:PromptTextBox}" BasedOn="{StaticResource GitHubTextBox}">
67-
<Setter Property="Background" Value="{DynamicResource GitHubVsBrandedUIBackground}"/>
68-
<Setter Property="Foreground" Value="{DynamicResource GitHubVsToolWindowText}"/>
69-
<Setter Property="BorderBrush" Value="{DynamicResource GitHubVsBrandedUIBorder}"/>
70-
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
71-
<Setter Property="HorizontalContentAlignment" Value="Left"/>
72-
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
73-
<Setter Property="AllowDrop" Value="true"/>
74-
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
75-
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
76-
<Setter Property="Height" Value="24" />
77-
<Setter Property="Template">
78-
<Setter.Value>
79-
<ControlTemplate TargetType="{x:Type ui:PromptTextBox}">
80-
<Grid>
81-
<Border x:Name="Bd" CornerRadius="0" ClipToBounds="True" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
82-
<Border CornerRadius="0" BorderBrush="Black" BorderThickness="0,1,0,0" Margin="2,-2,2,0" Opacity="0.4">
83-
<Border.Effect>
84-
<DropShadowEffect Direction="270" ShadowDepth="0" BlurRadius="4" Opacity="1" />
85-
</Border.Effect>
86-
</Border>
87-
</Border>
88-
89-
<Grid Margin="1,2,0,0">
90-
<ScrollViewer x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" VerticalAlignment="Top" Margin="0"/>
91-
<Label x:Name="PromptLabel" HorizontalAlignment="Left"
92-
Foreground="{DynamicResource GitHubVsGrayText}"
93-
FontSize="{TemplateBinding FontSize}" Margin="2,0,0,0" Padding="{TemplateBinding Padding}" Opacity="0"
94-
Target="{Binding ElementName=Bd}"
95-
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Focusable="False" IsHitTestVisible="False"
96-
VerticalAlignment="Top">
97-
<TextBlock Text="{TemplateBinding PromptText}" TextTrimming="CharacterEllipsis" />
98-
</Label>
99-
</Grid>
100-
</Grid>
101-
102-
<ControlTemplate.Triggers>
103-
<Trigger Property="IsEnabled" Value="False">
104-
<Setter Property="Opacity" Value="0.5" />
105-
</Trigger>
106-
<Trigger Property="IsMouseOver" Value="True">
107-
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource GitHubVsBrandedUIBorder}" />
108-
</Trigger>
109-
<Trigger Property="IsKeyboardFocusWithin" Value="True">
110-
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource GitHubAccentBrush}" />
111-
</Trigger>
112-
<DataTrigger Binding="{Binding Text.Length, RelativeSource={RelativeSource Self}}" Value="0">
113-
<Setter Property="Opacity" TargetName="PromptLabel" Value="0.7" />
114-
<Setter Property="Foreground" Value="Transparent" />
115-
</DataTrigger>
116-
</ControlTemplate.Triggers>
117-
</ControlTemplate>
118-
</Setter.Value>
119-
</Setter>
120-
</Style>
12166
</ResourceDictionary>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
4+
xmlns:local="clr-namespace:GitHub.VisualStudio.Styles">
5+
6+
<Style x:Key="GitHubVsPromptTextBox" TargetType="{x:Type ui:PromptTextBox}">
7+
<Setter Property="Background" Value="{DynamicResource GitHubVsBrandedUIBackground}"/>
8+
<Setter Property="Foreground" Value="{DynamicResource GitHubVsToolWindowText}"/>
9+
<Setter Property="BorderBrush" Value="{DynamicResource GitHubVsBrandedUIBorder}"/>
10+
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
11+
<Setter Property="HorizontalContentAlignment" Value="Left"/>
12+
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
13+
<Setter Property="AllowDrop" Value="true"/>
14+
<Setter Property="Padding" Value="5"/>
15+
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
16+
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
17+
<Setter Property="Template">
18+
<Setter.Value>
19+
<ControlTemplate TargetType="{x:Type ui:PromptTextBox}">
20+
<Grid>
21+
<Border x:Name="Bd" CornerRadius="0" ClipToBounds="True" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
22+
<Border CornerRadius="0" BorderBrush="Black" BorderThickness="0,1,0,0" Margin="0,-2,0,0" Opacity="0.4">
23+
<Border.Effect>
24+
<DropShadowEffect Direction="270" ShadowDepth="0" BlurRadius="4" Opacity="1" />
25+
</Border.Effect>
26+
</Border>
27+
</Border>
28+
29+
<Grid>
30+
<ScrollViewer x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" VerticalAlignment="Top" Margin="0"/>
31+
<Label x:Name="PromptLabel" HorizontalAlignment="Left"
32+
Foreground="{DynamicResource GitHubVsGrayText}"
33+
FontSize="{TemplateBinding FontSize}" Padding="{TemplateBinding Padding}" Opacity="0"
34+
Target="{Binding ElementName=Bd}"
35+
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Focusable="False" IsHitTestVisible="False"
36+
VerticalAlignment="Top">
37+
<TextBlock Text="{TemplateBinding PromptText}" Margin="2,0,0,0" TextTrimming="CharacterEllipsis" />
38+
</Label>
39+
</Grid>
40+
</Grid>
41+
42+
<ControlTemplate.Triggers>
43+
<Trigger Property="IsEnabled" Value="False">
44+
<Setter Property="Opacity" Value="0.5" />
45+
</Trigger>
46+
<Trigger Property="IsMouseOver" Value="True">
47+
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource GitHubVsBrandedUIBorder}" />
48+
</Trigger>
49+
<Trigger Property="IsKeyboardFocusWithin" Value="True">
50+
<Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource GitHubAccentBrush}" />
51+
</Trigger>
52+
<DataTrigger Binding="{Binding Text.Length, RelativeSource={RelativeSource Self}}" Value="0">
53+
<Setter Property="Opacity" TargetName="PromptLabel" Value="0.7" />
54+
<Setter Property="Foreground" Value="Transparent" />
55+
</DataTrigger>
56+
</ControlTemplate.Triggers>
57+
</ControlTemplate>
58+
</Setter.Value>
59+
</Setter>
60+
</Style>
61+
</ResourceDictionary>

src/GitHub.VisualStudio/UI/Views/PullRequestCreationView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@
153153
<TabItem Header="Details" Style="{DynamicResource GitHubPRDetailsTabItem}">
154154
<ScrollViewer VerticalScrollBarVisibility="Auto">
155155
<StackPanel Orientation="Vertical">
156-
<ui:PromptTextBox Margin="10,5" PromptText="Title" Style="{StaticResource GitHubVsPromptTextBox}" />
157-
<ui:PromptTextBox Margin="10,5" PromptText="Description" TextWrapping="Wrap" AcceptsReturn="True" Height="100" Style="{StaticResource GitHubVsPromptTextBox}" />
156+
<ui:PromptTextBox Margin="10,5" PromptText="Title" Style="{DynamicResource GitHubVsPromptTextBox}" />
157+
<ui:PromptTextBox Margin="10,5" PromptText="Description" TextWrapping="Wrap" AcceptsReturn="True" Height="100" Style="{DynamicResource GitHubVsPromptTextBox}" />
158158
<Grid Margin="10,3">
159159
<Grid.ColumnDefinitions>
160160
<ColumnDefinition Width="Auto" />

0 commit comments

Comments
 (0)