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

Commit f9b2853

Browse files
committed
Move PromptTextBox style to SharedDictionary
1 parent 205306f commit f9b2853

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

src/GitHub.VisualStudio/SharedDictionary.xaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
5+
xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
56
xmlns:cache="clr-namespace:GitHub.VisualStudio.Helpers">
67

78
<ResourceDictionary.MergedDictionaries>
@@ -61,4 +62,60 @@
6162
</Setter.Value>
6263
</Setter>
6364
</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>
64121
</ResourceDictionary>

0 commit comments

Comments
 (0)