From 4a5f0601bd829771dce2db241da1ea3091031c13 Mon Sep 17 00:00:00 2001 From: brianlagunas_cp Date: Wed, 4 May 2011 13:59:34 +0000 Subject: [PATCH] MaskedTextBox: fixed focus issue that I fixed a long time ago but somehow re-intorduced. --- .../Implementation/MaskedTextBox.cs | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/Implementation/MaskedTextBox.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/Implementation/MaskedTextBox.cs index 6dd0f035..a7171e7a 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/Implementation/MaskedTextBox.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MaskedTextBox/Implementation/MaskedTextBox.cs @@ -334,8 +334,6 @@ namespace Microsoft.Windows.Controls }; } - #endregion //Private - private object ConvertTextToValue(string text) { object convertedValue = null; @@ -380,7 +378,7 @@ namespace Microsoft.Windows.Controls return MaskProvider.ToDisplayString(); } - protected void SyncTextAndValueProperties(DependencyProperty p, object newValue) + private void SyncTextAndValueProperties(DependencyProperty p, object newValue) { //prevents recursive syncing properties if (_isSyncingTextAndValueProperties) @@ -400,6 +398,23 @@ namespace Microsoft.Windows.Controls _isSyncingTextAndValueProperties = false; } + #endregion //Private + + #region Public + + /// + /// Attempts to set focus to this element. + /// + public new void Focus() + { + if (TextBox != null) + TextBox.Focus(); + else + base.Focus(); + } + + #endregion //Public + #endregion //Methods #region Commands