1 vote
closed
MaskedTextBox.IsReadOnly property is not working

Description

 
I just noticed that IsReadOnly property has no effect on MaskedTextBox - the text can still be edited even if IsReadOnly is set to True.

Thanks.

File Attachments


No files are attached


Closed Feb 15 2008 at 10:54 PM  by marlongrech
closed revision 4983

Comments

most recent at top (show oldest at top)
marlongrech wrote Apr 16 2008 at 10:06 PM
Great idea about the Value property I will add it for AvalonControlsLib v3 :)
Thanks a lot for the suggestion ....

basile wrote Apr 16 2008 at 7:07 PM
OK, I take the IsReadOnly issue back - that was something else...

Although I noticed another problem - Text propery contains both the actual value and masking chars (meaning for phone number it returns (000) 000-0000) which is not right, it needs to return the actual value without the mask (0000000000 in my example).
Even better (and maybe easier) to add a "Value" property that would only return the actual value, whereas "Text" included masking chars.

Thanks!

basile wrote Apr 16 2008 at 6:53 PM
That is not entirely correct - the issue comes up only when Text property is data-bound. Seems like data binding (even in Mode=OneWay) resets IsReadOnly back to "false".

basile wrote Apr 16 2008 at 6:29 PM
By some reason, IsReadOnly property is still set to "false" in the code, even though I set it to IsReadOnly="True" in XAML control declaration...

marlongrech wrote Feb 15 2008 at 10:53 PM
I fixed this issue.... what you need to do is to return when the text is changed and the Isreadonly property is set to true.... so in the OnPreviewTextInput you have to add this code

//if the text is readonly do not add the text
if (IsReadOnly)
{
e.Handled = true;
return;
}

I also uploaded the new version of the code (Revision 4983)

Again thanks for submitting the bug :D

marlongrech wrote Feb 15 2008 at 10:34 PM
Thanks for submitting this bug.... I will have a look at it .... Thank again

Updating...
© 2006-2010 Microsoft | About CodePlex | Privacy Statement | Terms of Use | Code of Conduct | Advertise With Us | Version 2010.1.12.16187