更新整理
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
|
||||
|
||||
|
||||
using WPFluent.Input;
|
||||
|
||||
using System.Diagnostics;
|
||||
|
||||
using System.Windows.Controls;
|
||||
|
||||
using WPFluent.Input;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace WPFluent.Controls;
|
||||
|
||||
@@ -105,7 +107,7 @@ public class TextBox : System.Windows.Controls.TextBox
|
||||
|
||||
private static void OnPlaceholderEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if(d is not TextBox control)
|
||||
if (d is not TextBox control)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -118,7 +120,7 @@ public class TextBox : System.Windows.Controls.TextBox
|
||||
/// </summary>
|
||||
protected void HideClearButton()
|
||||
{
|
||||
if(ClearButtonEnabled && !IsKeyboardFocusWithin && ShowClearButton)
|
||||
if (ClearButtonEnabled && !IsKeyboardFocusWithin && ShowClearButton)
|
||||
{
|
||||
SetCurrentValue(ShowClearButtonProperty, false);
|
||||
}
|
||||
@@ -129,7 +131,7 @@ public class TextBox : System.Windows.Controls.TextBox
|
||||
/// </summary>
|
||||
protected virtual void OnClearButtonClick()
|
||||
{
|
||||
if(Text.Length > 0)
|
||||
if (Text.Length > 0)
|
||||
{
|
||||
SetCurrentValue(TextProperty, string.Empty);
|
||||
}
|
||||
@@ -180,7 +182,7 @@ public class TextBox : System.Windows.Controls.TextBox
|
||||
/// </summary>
|
||||
protected void RevealClearButton()
|
||||
{
|
||||
if(ClearButtonEnabled && IsKeyboardFocusWithin)
|
||||
if (ClearButtonEnabled && IsKeyboardFocusWithin)
|
||||
{
|
||||
SetCurrentValue(ShowClearButtonProperty, Text.Length > 0);
|
||||
}
|
||||
@@ -188,19 +190,19 @@ public class TextBox : System.Windows.Controls.TextBox
|
||||
|
||||
protected void SetPlaceholderTextVisibility()
|
||||
{
|
||||
if(PlaceholderEnabled)
|
||||
if (PlaceholderEnabled)
|
||||
{
|
||||
if(CurrentPlaceholderEnabled && Text.Length > 0)
|
||||
if (CurrentPlaceholderEnabled && Text.Length > 0)
|
||||
{
|
||||
SetCurrentValue(CurrentPlaceholderEnabledProperty, false);
|
||||
}
|
||||
|
||||
if(!CurrentPlaceholderEnabled && Text.Length < 1)
|
||||
if (!CurrentPlaceholderEnabled && Text.Length < 1)
|
||||
{
|
||||
SetCurrentValue(CurrentPlaceholderEnabledProperty, true);
|
||||
}
|
||||
}
|
||||
else if(CurrentPlaceholderEnabled)
|
||||
else if (CurrentPlaceholderEnabled)
|
||||
{
|
||||
SetCurrentValue(CurrentPlaceholderEnabledProperty, false);
|
||||
}
|
||||
@@ -277,5 +279,5 @@ public class TextBox : System.Windows.Controls.TextBox
|
||||
/// <summary>
|
||||
/// Gets the command triggered when clicking the button.
|
||||
/// </summary>
|
||||
public IRelayCommand TemplateButtonCommand => (IRelayCommand)GetValue(TemplateButtonCommandProperty);
|
||||
internal IRelayCommand TemplateButtonCommand => (IRelayCommand)GetValue(TemplateButtonCommandProperty);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:WPFluent.Controls"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime">
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<Thickness x:Key="TextBoxBorderThemeThickness">1,1,1,1</Thickness>
|
||||
<Thickness x:Key="TextBoxAccentBorderThemeThickness">0,0,0,1</Thickness>
|
||||
|
||||
Reference in New Issue
Block a user