From 30959ea2f9cbbd458da16da291887e45a164213e Mon Sep 17 00:00:00 2001 From: EpicKip Date: Tue, 26 Jun 2018 15:37:47 +0200 Subject: [PATCH] Add toggle to include prompt on readonly Added a bool property to display prompt characters when in a ReadOnly state. - Note - If this is wrong in some way (guidelines) please contact me. --- .../MaskedTextBox/Implementation/MaskedTextBox.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MaskedTextBox/Implementation/MaskedTextBox.cs b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MaskedTextBox/Implementation/MaskedTextBox.cs index f9c7932a9..4ca527ed8 100644 --- a/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MaskedTextBox/Implementation/MaskedTextBox.cs +++ b/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/MaskedTextBox/Implementation/MaskedTextBox.cs @@ -252,6 +252,8 @@ public bool AllowPromptAsInput SetValue( AllowPromptAsInputProperty, value ); } } + + public bool DisplayPromptCharactersOnReadOnly { get;set; } private static void AllowPromptAsInputPropertyChangedCallback( object sender, DependencyPropertyChangedEventArgs e ) { @@ -1915,7 +1917,7 @@ private string GetFormattedString( MaskedTextProvider provider, string text ) //System.Diagnostics.Debug.Assert( provider.EditPositionCount > 0 ); - bool includePrompt = ( this.IsReadOnly ) ? false : ( !this.HidePromptOnLeave || this.IsFocused ); + bool includePrompt = ( this.IsReadOnly && !this.DisplayPromptCharactersOnReadOnly ) ? false : ( !this.HidePromptOnLeave || this.IsFocused ); string displayString = provider.ToString( false, includePrompt, true, 0, m_maskedTextProvider.Length );