Browse Source

Add SelectedText to TextBox

Deadpikle 5 years ago
parent
commit
a429159c3c
1 changed files with 16 additions and 0 deletions
  1. 16 0
      src/Avalonia.Controls/TextBox.cs

+ 16 - 0
src/Avalonia.Controls/TextBox.cs

@@ -275,6 +275,22 @@ namespace Avalonia.Controls
             }
         }
 
+        public string SelectedText
+        {
+            get { return GetSelection(); }
+            set
+            {
+                if (value == null)
+                {
+                    return;
+                }
+
+                _undoRedoHelper.Snapshot();
+                HandleTextInput(value);
+                _undoRedoHelper.Snapshot();
+            }
+        }
+
         /// <summary>
         /// Gets or sets the horizontal alignment of the content within the control.
         /// </summary>