|
|
@@ -97,6 +97,7 @@ namespace Avalonia.Controls
|
|
|
private UndoRedoHelper<UndoRedoState> _undoRedoHelper;
|
|
|
private bool _ignoreTextChanges;
|
|
|
private IEnumerable<Exception> _dataValidationErrors;
|
|
|
+ private static readonly string[] invalidCharacters = new String[1]{"\u007f"};
|
|
|
|
|
|
static TextBox()
|
|
|
{
|
|
|
@@ -280,6 +281,7 @@ namespace Avalonia.Controls
|
|
|
{
|
|
|
if (!IsReadOnly)
|
|
|
{
|
|
|
+ input = RemoveInvalidCharacters(input);
|
|
|
string text = Text ?? string.Empty;
|
|
|
int caretIndex = CaretIndex;
|
|
|
if (!string.IsNullOrEmpty(input))
|
|
|
@@ -295,6 +297,16 @@ namespace Avalonia.Controls
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public string RemoveInvalidCharacters(string text)
|
|
|
+ {
|
|
|
+ for (var i = 0; i < invalidCharacters.Length; i++)
|
|
|
+ {
|
|
|
+ text = text.Replace(invalidCharacters[i], string.Empty);
|
|
|
+ }
|
|
|
+
|
|
|
+ return text;
|
|
|
+ }
|
|
|
+
|
|
|
private async void Copy()
|
|
|
{
|
|
|
await ((IClipboard)AvaloniaLocator.Current.GetService(typeof(IClipboard)))
|