Finally corrected strange behaviour in TextBoxWithButton where text would sometimes not appear unless pointed over

This commit is contained in:
BONNEVILLE Geoffroy
2018-07-27 10:52:23 +02:00
parent 89d43e21eb
commit 62f2be8823

View File

@@ -84,12 +84,10 @@
Margin="{TemplateBinding BorderThickness}"> Margin="{TemplateBinding BorderThickness}">
<TextBlock x:Name="GlyphElement" <TextBlock x:Name="GlyphElement"
Foreground="{ThemeResource TextBoxButtonForegroundThemeBrush}" Foreground="{ThemeResource TextBoxButtonForegroundThemeBrush}"
Padding="4,0,4,0"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Center" HorizontalAlignment="Center"
FontStyle="Normal" FontStyle="Normal"
Text="{TemplateBinding Content}" Text="{TemplateBinding Content}"
FontSize="{TemplateBinding FontSize}"
FontFamily="{ThemeResource SymbolThemeFontFamily}" FontFamily="{ThemeResource SymbolThemeFontFamily}"
AutomationProperties.AccessibilityView="Raw"/> AutomationProperties.AccessibilityView="Raw"/>
</Border> </Border>
@@ -143,7 +141,7 @@
Storyboard.TargetProperty="Opacity" Storyboard.TargetProperty="Opacity"
Duration="0" Duration="0"
To="{ThemeResource TextControlPointerOverBorderThemeOpacity}" /> To="{ThemeResource TextControlPointerOverBorderThemeOpacity}" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton"
Storyboard.TargetProperty="Visibility"> Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value> <DiscreteObjectKeyFrame.Value>
@@ -155,7 +153,7 @@
</VisualState> </VisualState>
<VisualState x:Name="Focused"> <VisualState x:Name="Focused">
<Storyboard> <Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton"
Storyboard.TargetProperty="Visibility"> Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value> <DiscreteObjectKeyFrame.Value>
@@ -169,7 +167,7 @@
<VisualStateGroup x:Name="ButtonStates"> <VisualStateGroup x:Name="ButtonStates">
<VisualState x:Name="ButtonVisible"> <VisualState x:Name="ButtonVisible">
<Storyboard> <Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton" <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton"
Storyboard.TargetProperty="Visibility"> Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value> <DiscreteObjectKeyFrame.Value>
@@ -217,7 +215,6 @@
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}" IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}" IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}" IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding BorderThickness}" Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
IsTabStop="False" IsTabStop="False"
@@ -228,12 +225,11 @@
Foreground="{ThemeResource TextBoxPlaceholderTextThemeBrush}" Foreground="{ThemeResource TextBoxPlaceholderTextThemeBrush}"
Margin="{TemplateBinding BorderThickness}" Margin="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}" Padding="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
IsTabStop="False" IsTabStop="False"
Grid.ColumnSpan="2" Grid.Column="0" Grid.ColumnSpan="2" Grid.Column="0"
Content="{TemplateBinding PlaceholderText}" Content="{TemplateBinding PlaceholderText}"
IsHitTestVisible="False"/> IsHitTestVisible="False"/>
<Button x:Name="ActionButton" <Button x:Name="DeleteButton"
Grid.Row="1" Grid.Row="1"
Style="{StaticResource ActionButtonStyle}" Style="{StaticResource ActionButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"