Hello.
After a few tries, I came to a method that dynamically changes shades depending on the amount of characters MaskedEditBox:
public
partial
class
RadForm6 : Telerik.WinControls.UI.RadForm
{
public
RadForm6()
{
InitializeComponent();
this
.radMaskedEditBox1.TextChanged += radMaskedEditBox1_TextChanged;
this
.radMaskedEditBox1.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
this
.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
this
.radMaskedEditBox1.Mask =
"000,000,000-0099"
;
this
.radMaskedEditBox1.PromptChar =
' '
;
}
string
initialValue =
string
.Empty;
private
void
radMaskedEditBox1_TextChanged(
object
sender, EventArgs e)
{
if
((radMaskedEditBox1.Value +
""
).Length <= 11 &&
this
.radMaskedEditBox1.Mask !=
"000,000,000-0099"
)
{
this
.radMaskedEditBox1.TextChanged -= radMaskedEditBox1_TextChanged;
initialValue =
this
.radMaskedEditBox1.Value +
""
;
this
.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
this
.radMaskedEditBox1.Mask =
"000,000,000-0099"
;
this
.radMaskedEditBox1.PromptChar =
' '
;
this
.radMaskedEditBox1.Value = initialValue;
this
.radMaskedEditBox1.TextChanged += radMaskedEditBox1_TextChanged;
}
else
if
((radMaskedEditBox1.Value +
""
).Length >= 12 &&
this
.radMaskedEditBox1.Mask !=
"00,000,000/0000-00"
)
{
this
.radMaskedEditBox1.TextChanged -= radMaskedEditBox1_TextChanged;
initialValue =
this
.radMaskedEditBox1.Value +
""
;
this
.radMaskedEditBox1.MaskType = Telerik.WinControls.UI.MaskType.Standard;
this
.radMaskedEditBox1.Mask =
"00,000,000/0000-00"
;
//this.radMaskedEditBox1.PromptChar = ' ';
this
.radMaskedEditBox1.Value = initialValue;
this
.radMaskedEditBox1.TextChanged += radMaskedEditBox1_TextChanged;
}
}
}
I hope it helps.
Regards,
Felipe