diff --git a/src/Snap.Hutao/Snap.Hutao/App.xaml b/src/Snap.Hutao/Snap.Hutao/App.xaml
index a0ce6a1d..a766d4be 100644
--- a/src/Snap.Hutao/Snap.Hutao/App.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/App.xaml
@@ -12,6 +12,7 @@
+
@@ -38,7 +39,6 @@
-
-
+
@@ -77,7 +75,7 @@
-
+
@@ -125,7 +123,7 @@
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
-
+
!OwningTokenizingTextBox.IsEnabled;
+ public bool IsReadOnly => !OwningAutoSuggestTokenBox.IsEnabled;
- public string Value => OwningTokenizingTextBox.Text;
+ public string Value => OwningAutoSuggestTokenBox.Text;
- private TokenizingTextBox OwningTokenizingTextBox
+ private AutoSuggestTokenBox OwningAutoSuggestTokenBox
{
- get => (TokenizingTextBox)Owner;
+ get => (AutoSuggestTokenBox)Owner;
}
public void SetValue(string value)
{
if (IsReadOnly)
{
- throw new ElementNotEnabledException($"Could not set the value of the {nameof(TokenizingTextBox)} ");
+ throw new ElementNotEnabledException($"Could not set the value of the {nameof(AutoSuggestTokenBox)} ");
}
- OwningTokenizingTextBox.Text = value;
+ OwningAutoSuggestTokenBox.Text = value;
}
protected override string GetClassNameCore()
@@ -41,13 +41,13 @@ internal class TokenizingTextBoxAutomationPeer : ListViewBaseAutomationPeer, IVa
protected override string GetNameCore()
{
- string name = OwningTokenizingTextBox.Name;
+ string name = OwningAutoSuggestTokenBox.Name;
if (!string.IsNullOrWhiteSpace(name))
{
return name;
}
- name = AutomationProperties.GetName(OwningTokenizingTextBox);
+ name = AutomationProperties.GetName(OwningAutoSuggestTokenBox);
return !string.IsNullOrWhiteSpace(name) ? name : base.GetNameCore();
}
@@ -62,7 +62,7 @@ internal class TokenizingTextBoxAutomationPeer : ListViewBaseAutomationPeer, IVa
protected override IList GetChildrenCore()
{
- TokenizingTextBox owner = OwningTokenizingTextBox;
+ AutoSuggestTokenBox owner = OwningAutoSuggestTokenBox;
ItemCollection items = owner.Items;
if (items.Count <= 0)
@@ -73,7 +73,7 @@ internal class TokenizingTextBoxAutomationPeer : ListViewBaseAutomationPeer, IVa
List peers = new(items.Count);
for (int i = 0; i < items.Count; i++)
{
- if (owner.ContainerFromIndex(i) is TokenizingTextBoxItem element)
+ if (owner.ContainerFromIndex(i) is AutoSuggestTokenBoxItem element)
{
peers.Add(FromElement(element) ?? CreatePeerForElement(element));
}
diff --git a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/TokenizingTextBox/TokenizingTextBoxItem.cs b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/AutoSuggestBox/AutoSuggestTokenBoxItem.cs
similarity index 90%
rename from src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/TokenizingTextBox/TokenizingTextBoxItem.cs
rename to src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/AutoSuggestBox/AutoSuggestTokenBoxItem.cs
index da93d011..b8780776 100644
--- a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/TokenizingTextBox/TokenizingTextBoxItem.cs
+++ b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/AutoSuggestBox/AutoSuggestTokenBoxItem.cs
@@ -10,14 +10,14 @@ using Microsoft.UI.Xaml.Input;
using Windows.Foundation;
using Windows.System;
-namespace Snap.Hutao.UI.Xaml.Control.TokenizingTextBox;
+namespace Snap.Hutao.UI.Xaml.Control.AutoSuggestBox;
[DependencyProperty("ClearButtonStyle", typeof(Style))]
-[DependencyProperty("Owner", typeof(TokenizingTextBox))]
+[DependencyProperty("Owner", typeof(AutoSuggestTokenBox))]
[TemplatePart(Name = TokenRemoveButton, Type = typeof(ButtonBase))] //// Token case
[TemplatePart(Name = TextAutoSuggestBox, Type = typeof(Microsoft.UI.Xaml.Controls.AutoSuggestBox))] //// String case
[TemplatePart(Name = TextTokensCounter, Type = typeof(Microsoft.UI.Xaml.Controls.TextBlock))]
-internal partial class TokenizingTextBoxItem : ListViewItem
+internal partial class AutoSuggestTokenBoxItem : ListViewItem
{
private const string TokenRemoveButton = nameof(TokenRemoveButton);
private const string TextAutoSuggestBox = nameof(TextAutoSuggestBox);
@@ -29,16 +29,16 @@ internal partial class TokenizingTextBoxItem : ListViewItem
private bool isSelectedFocusOnFirstCharacter;
private bool isSelectedFocusOnLastCharacter;
- public TokenizingTextBoxItem()
+ public AutoSuggestTokenBoxItem()
{
- DefaultStyleKey = typeof(TokenizingTextBoxItem);
+ DefaultStyleKey = typeof(AutoSuggestTokenBoxItem);
KeyDown += OnKeyDown;
}
- public event TypedEventHandler? AutoSuggestTextBoxLoaded;
+ public event TypedEventHandler? AutoSuggestTextBoxLoaded;
- public event TypedEventHandler? ClearAllAction;
+ public event TypedEventHandler? ClearAllAction;
public Microsoft.UI.Xaml.Controls.AutoSuggestBox? AutoSuggestBox
{
@@ -146,7 +146,7 @@ internal partial class TokenizingTextBoxItem : ListViewItem
{
fis.FontSize = 16;
- if (Owner.TryFindResource("TokenizingTextBoxIconFontSize", out object? fontSizeObj) && fontSizeObj is double fontSize)
+ if (Owner.TryFindResource("AutoSuggestTokenBoxIconFontSize", out object? fontSizeObj) && fontSizeObj is double fontSize)
{
fis.FontSize = fontSize;
}
@@ -173,14 +173,14 @@ internal partial class TokenizingTextBoxItem : ListViewItem
private void OnASBGotFocus(object sender, RoutedEventArgs e)
{
// Verify if the usual behavior of clearing token selection is required
- if (!Owner.PauseTokenClearOnFocus && !TokenizingTextBox.IsShiftPressed)
+ if (!Owner.PauseTokenClearOnFocus && !AutoSuggestTokenBox.IsShiftPressed)
{
Owner.DeselectAll();
}
Owner.PauseTokenClearOnFocus = false;
- VisualStateManager.GoToState(Owner, TokenizingTextBox.FocusedState, true);
+ VisualStateManager.GoToState(Owner, AutoSuggestTokenBox.FocusedState, true);
}
private void OnASBLoaded(object sender, RoutedEventArgs e)
@@ -216,17 +216,17 @@ internal partial class TokenizingTextBoxItem : ListViewItem
private void OnASBLostFocus(object sender, RoutedEventArgs e)
{
- VisualStateManager.GoToState(Owner, TokenizingTextBox.UnfocusedState, true);
+ VisualStateManager.GoToState(Owner, AutoSuggestTokenBox.UnfocusedState, true);
}
private void OnASBPointerEntered(object sender, PointerRoutedEventArgs e)
{
- VisualStateManager.GoToState(Owner, TokenizingTextBox.PointerOverState, true);
+ VisualStateManager.GoToState(Owner, AutoSuggestTokenBox.PointerOverState, true);
}
private void OnASBPointerExited(object sender, PointerRoutedEventArgs e)
{
- VisualStateManager.GoToState(Owner, TokenizingTextBox.NormalState, true);
+ VisualStateManager.GoToState(Owner, AutoSuggestTokenBox.NormalState, true);
}
private void OnASBQuerySubmitted(Microsoft.UI.Xaml.Controls.AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
@@ -316,7 +316,7 @@ internal partial class TokenizingTextBoxItem : ListViewItem
{
if (Owner.SelectPreviousItem(this))
{
- if (!TokenizingTextBox.IsShiftPressed)
+ if (!AutoSuggestTokenBox.IsShiftPressed)
{
// Clear any text box selection
autoSuggestTextBox.SelectionLength = 0;
@@ -333,7 +333,7 @@ internal partial class TokenizingTextBoxItem : ListViewItem
{
if (Owner.SelectNextItem(this))
{
- if (!TokenizingTextBox.IsShiftPressed)
+ if (!AutoSuggestTokenBox.IsShiftPressed)
{
// Clear any text box selection
autoSuggestTextBox.SelectionLength = 0;
@@ -343,7 +343,7 @@ internal partial class TokenizingTextBoxItem : ListViewItem
}
}
}
- else if (e.Key is VirtualKey.A && TokenizingTextBox.IsControlPressed)
+ else if (e.Key is VirtualKey.A && AutoSuggestTokenBox.IsControlPressed)
{
// Need to provide this shortcut from the textbox only, as ListViewBase will do it for us on token.
Owner.SelectAllTokensAndText();
@@ -352,7 +352,7 @@ internal partial class TokenizingTextBoxItem : ListViewItem
private void OnAutoSuggestTextBoxSelectionChanged(object sender, RoutedEventArgs args)
{
- if (!(IsAllSelected || TokenizingTextBox.IsShiftPressed || Owner.IsClearingForClick))
+ if (!(IsAllSelected || AutoSuggestTokenBox.IsShiftPressed || Owner.IsClearingForClick))
{
Owner.DeselectAllTokensAndText(this);
}
diff --git a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/TokenizingTextBox/TokenizingTextBoxItem.xaml b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/AutoSuggestBox/AutoSuggestTokenBoxItem.xaml
similarity index 96%
rename from src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/TokenizingTextBox/TokenizingTextBoxItem.xaml
rename to src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/AutoSuggestBox/AutoSuggestTokenBoxItem.xaml
index 6bac7416..3ee8f0c8 100644
--- a/src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/TokenizingTextBox/TokenizingTextBoxItem.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/UI/Xaml/Control/AutoSuggestBox/AutoSuggestTokenBoxItem.xaml
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
- xmlns:shuxct="using:Snap.Hutao.UI.Xaml.Control.TokenizingTextBox"
+ xmlns:shuxca="using:Snap.Hutao.UI.Xaml.Control.AutoSuggestBox"
xmlns:shuxm="using:Snap.Hutao.UI.Xaml.Markup"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
@@ -75,16 +75,16 @@
10,3,6,6
- 10
+ 10
8,4,4,4
- 0,-2,0,1
- Center
- Center
+ 0,-2,0,1
+ Center
+ Center
0,0,0,8
-
-
-
-
-
+
+