Textbox button now works again correctly (but has caret instead of pointer...)

This commit is contained in:
BONNEVILLE Geoffroy
2018-07-30 16:29:28 +02:00
parent 62f2be8823
commit b2dd028fc7
2 changed files with 9 additions and 5 deletions

View File

@@ -1,4 +1,6 @@
using System; using System;
using System.Linq;
using System.Reflection;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
@@ -6,6 +8,8 @@ namespace ModernKeePass.Controls
{ {
public class TextBoxWithButton : TextBox public class TextBoxWithButton : TextBox
{ {
public event EventHandler<RoutedEventArgs> ButtonClick;
public string ButtonSymbol public string ButtonSymbol
{ {
get { return (string)GetValue(ButtonSymbolProperty); } get { return (string)GetValue(ButtonSymbolProperty); }
@@ -17,7 +21,6 @@ namespace ModernKeePass.Controls
typeof(string), typeof(string),
typeof(TextBoxWithButton), typeof(TextBoxWithButton),
new PropertyMetadata("&#xE107;", (o, args) => { })); new PropertyMetadata("&#xE107;", (o, args) => { }));
public event EventHandler<RoutedEventArgs> ButtonClick;
public string ButtonTooltip public string ButtonTooltip
{ {

View File

@@ -87,6 +87,7 @@
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Center" HorizontalAlignment="Center"
FontStyle="Normal" FontStyle="Normal"
Padding="4,0,4,0"
Text="{TemplateBinding Content}" Text="{TemplateBinding Content}"
FontFamily="{ThemeResource SymbolThemeFontFamily}" FontFamily="{ThemeResource SymbolThemeFontFamily}"
AutomationProperties.AccessibilityView="Raw"/> AutomationProperties.AccessibilityView="Raw"/>
@@ -141,7 +142,7 @@
Storyboard.TargetProperty="Opacity" Storyboard.TargetProperty="Opacity"
Duration="0" Duration="0"
To="{ThemeResource TextControlPointerOverBorderThemeOpacity}" /> To="{ThemeResource TextControlPointerOverBorderThemeOpacity}" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton"
Storyboard.TargetProperty="Visibility"> Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value> <DiscreteObjectKeyFrame.Value>
@@ -153,7 +154,7 @@
</VisualState> </VisualState>
<VisualState x:Name="Focused"> <VisualState x:Name="Focused">
<Storyboard> <Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton"
Storyboard.TargetProperty="Visibility"> Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value> <DiscreteObjectKeyFrame.Value>
@@ -167,7 +168,7 @@
<VisualStateGroup x:Name="ButtonStates"> <VisualStateGroup x:Name="ButtonStates">
<VisualState x:Name="ButtonVisible"> <VisualState x:Name="ButtonVisible">
<Storyboard> <Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeleteButton" <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ActionButton"
Storyboard.TargetProperty="Visibility"> Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value> <DiscreteObjectKeyFrame.Value>
@@ -229,7 +230,7 @@
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="DeleteButton" <Button x:Name="ActionButton"
Grid.Row="1" Grid.Row="1"
Style="{StaticResource ActionButtonStyle}" Style="{StaticResource ActionButtonStyle}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"