From 90605c1fd58a65d5168060aa8e031f712caabf74 Mon Sep 17 00:00:00 2001 From: brianlagunas_cp Date: Tue, 9 Aug 2011 18:29:45 +0000 Subject: [PATCH] MaskedTextBox: implemented feature when all text is selected and user types a new value, all text is deleted and the new value is entered in its place. --- .../MaskedTextBox/Implementation/MaskedTextBox.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/Implementation/MaskedTextBox.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/Implementation/MaskedTextBox.cs index 2cbb62a9..e9be0a53 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/Implementation/MaskedTextBox.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/Implementation/MaskedTextBox.cs @@ -339,6 +339,13 @@ namespace Microsoft.Windows.Controls e.Handled = true; } + //if all text is selected and the user begins to type, we want to delete all selected text and continue typing the new values + if (SelectionLength == Text.Length) + { + if (provider.RemoveAt(position, endposition)) + UpdateText(provider, position); + } + base.OnPreviewKeyDown(e); }