We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

SfMaskedEdit - Change mask dynamically

Thread ID:

Created:

Updated:

Platform:

Replies:

119151 May 14,2015 06:30 PM UTC May 15,2015 06:15 AM UTC WinRT 1
loading
Tags: SfMaskedEdit
Josel
Asked On May 14, 2015 06:30 PM UTC

Hi,

I'm using a SfMaskedEdit control and trying to set the mask dynamically, I mean I have this mask (___) ___-____ for a phone number and I need to change the mask to this one (__) ____-____ at runtime when I press KeyUp, but what I'm getting when I write a phone number and change the mask is (122_123-1230. This is my code:

<syncfusion:SfMaskedEdit
                                x:Name="txtPhone"
                                Text="{Binding Customer.Telephone, Mode=TwoWay}" 
                                Mask="(000)000-0000" KeyUp="SfMaskedEdit_KeyUp"/>

private void SfMaskedEdit_KeyUp(object sender, KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Up)
{
txtPhone.Mask = "(000)000-0000";
txtPhone.Value = "(___)___-____";
txtPhone.Text = "(___)___-____";
}
else if (e.Key == Windows.System.VirtualKey.Down)
{
txtPhone.Mask = "(00)0000-0000";
txtPhone.Value = "(__)____-____";
txtPhone.Text = "(__)____-____";
}
}

Is it a bug or what am I doing wrong?

Thank you.


Victory Jessie Selvam D [Syncfusion]
Replied On May 15, 2015 06:15 AM UTC

Hi Josel,

Thank you for using Syncfusion products.

We were able to reproduce the issue "Changing Mask property dynamically is not working" and have logged defect report regarding this. The fix for this issue will be included in our upcoming Service pack release which is scheduled in end of May, 2015.

Setting Mask property is enough to generate the expression and match the value in KeyUp event handler. Also kindly use the Value property to bound the input(instead of Text) in SfMaskedEdit control. Based on this we have modified your sample kindly download it from the following link:

Sample: MaskedEdit_DynamicMask.zip

Please let us know if you need further assistance on this.

Regards,
Jessie

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;