Skip to content

Commit ddf1864

Browse files
committed
Fix #2785
Vailidation tooltips for VS TextBox does not show
1 parent c7430e4 commit ddf1864

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/MahApps.Metro/MahApps.Metro/Styles/VS/TextBox.xaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/VS/Colors.xaml" />
66
</ResourceDictionary.MergedDictionaries>
77

8-
<Style x:Key="StandardTextBox" TargetType="TextBox">
8+
<Style x:Key="StandardTextBox" TargetType="{x:Type TextBox}">
99
<Setter Property="Background" Value="{StaticResource TextBoxBackground}" />
1010
<Setter Property="CaretBrush" Value="{StaticResource Foreground}" />
1111
<Setter Property="Foreground" Value="{StaticResource Foreground}" />
12+
<Setter Property="Padding" Value="1" />
13+
<Setter Property="SnapsToDevicePixels" Value="True" />
14+
<Setter Property="Validation.ErrorTemplate" Value="{DynamicResource ValidationErrorTemplate}" />
1215
<Setter Property="Template">
1316
<Setter.Value>
1417
<ControlTemplate TargetType="{x:Type TextBox}">
15-
<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
16-
<ScrollViewer x:Name="PART_ContentHost" Margin="1" />
18+
<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
19+
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" />
1720
</Grid>
1821
<ControlTemplate.Triggers>
1922
<Trigger Property="IsMouseOver" Value="true">
@@ -28,21 +31,20 @@
2831
</Setter>
2932
</Style>
3033

31-
<Style x:Key="SearchTextBox" TargetType="TextBox">
32-
<Setter Property="Background" Value="{StaticResource TextBoxBackground}" />
33-
<Setter Property="CaretBrush" Value="{StaticResource Foreground}" />
34-
<Setter Property="Foreground" Value="{StaticResource Foreground}" />
34+
<Style x:Key="SearchTextBox"
35+
TargetType="{x:Type TextBox}"
36+
BasedOn="{StaticResource StandardTextBox}">
3537
<Setter Property="Template">
3638
<Setter.Value>
3739
<ControlTemplate TargetType="{x:Type TextBox}">
38-
<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
40+
<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
3941
<TextBlock Name="search"
4042
Margin="5 0 0 0"
4143
VerticalAlignment="Center"
4244
Foreground="{StaticResource SearchTextForeground}"
4345
Text="Search ..."
4446
Visibility="Hidden" />
45-
<ScrollViewer x:Name="PART_ContentHost" Margin="1" />
47+
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" />
4648
</Grid>
4749
<ControlTemplate.Triggers>
4850
<Trigger Property="TextBox.Text" Value="">

0 commit comments

Comments
 (0)