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. Image for the cookie policy date
close icon

Why is SFMaskedEdit remembering the last text and appending it to the new text despite clearing the value of the property it's bound to?

The SfMaskedEdit in my program is displaying a strange behavior, it takes whatever value I put into it, remembers it, and then appends it to the new value I put whenever I try to clear the previous value through my reset command.

C#
1. The property the Text Value is bound to:
        private Customer newCustomer;
        public Customer NewCustomer
        {
            get { return newCustomer; }
            set { newCustomer = value; RaisePropertyChanged("NewCustomer"); }
        }

        public class Customer : BaseSearchableCollectionClass
        {
            private string firstName;
            public string FirstName
            {
                get { return firstName; }
                set { firstName = value; RaisePropertyChanged("FirstName"); }
            }

2. The reset command:
        public RelayCommand ResetNewCustomerCommand { get; private set; }
        public void ResetNewCustomer(object message)
        {
            NewCustomer = new Customer();
        }
        public bool ResetNewCustomerCanUse(object msg)
        {
            if (HasChange() == true)
                return true;
            return false;
        }

XAML
1. SFMaskedEdit:
     
          Text="{Binding NewCustomer.FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"                          
          Mask="[0-9a-zA-Z ]{0,20}" 
          MaskType="RegEx"
     />

2. Reset Button:
     
          Command="{Binding ResetNewCustomerCommand}" 
          Content="Reset"
     />


17 Replies

JP Jagadeesan Pichaimuthu Syncfusion Team June 26, 2019 10:22 AM UTC

Hi Mark 
 
Thanks for contacting Syncfusion support.   
 
We have tried to reproduce the reported issue “Old text value is appended to new text value” at our end. But we unable to reproduce the reported issue at our end. May be our issue reproducing scenario may differ from yours. So please provide replication steps or modify the application which we provided below to test it from our side or provide the issue reproducible application and also confirm your current version, that would help us to resolve your issue as earlier. Please find the video and sample for the same. 
  
  
   
Regards, 
Jagadeesan 



MA Mark June 26, 2019 01:23 PM UTC

The mask type was supposed to be regex and there shouldn't be a default value since it's a field for the customer to put his name.

I recreated my implementation using your example and got the same problem wherein if I tried to reset the property and write on the masked edit, it appends the previous value to the new one. It's like this: https://gfycat.com/embellishedpalefantail

1. C#
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

        }
        private void SfMaskedEdit_Loaded(object sender, RoutedEventArgs e)
        {
            CustomerViewModel model = new CustomerViewModel();

            this.DataContext = model;
        }

    }

    public class CustomerViewModel: INotifyPropertyChanged
    {
        private Customer newCustomer;

        public CustomerViewModel()
        {
            NewCustomer = new Customer();
        }

        public Customer NewCustomer
        {
            get { return newCustomer; }
            set { newCustomer = value; RaisePropertyChanged("NewCustomer"); }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void RaisePropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }

        private ICommand resetcmd;

        public ICommand ResetNewCustomer
        {
            get
            {
                resetcmd = new DelegateCommand(Reset, CanReset);
                return resetcmd;
            }

        }

        private bool CanReset(object arg)
        {
            return true;
        }

        private void Reset(object obj)
        {
            NewCustomer = new Customer();
        }
    }

    public class Customer : INotifyPropertyChanged
    {
        private string firstName;
        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; RaisePropertycanged("FirstName"); }
        }

        //
        // Summary:
        //     Occurs when a property value changes.
        public event PropertyChangedEventHandler PropertyChanged;
        public void RaisePropertycanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
    }

2. XAML
    <Grid>
        <StackPanel VerticalAlignment="Center">
            <syncfusion:SfMaskedEdit 
                Text="{Binding NewCustomer.FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"                          
                MaskType="RegEx" 
                Mask="[0-9a-zA-Z ]{0,20}" 
                Width="255"
                Height="46"
                Loaded="SfMaskedEdit_Loaded" 
                VerticalAlignment="Center"/>
            <Button  
                Height="40" 
                Width="100" 
                Margin="15"
                Command="{Binding ResetNewCustomer}" 
                Content="Reset" />
        </StackPanel>
    </Grid>



JP Jagadeesan Pichaimuthu Syncfusion Team June 27, 2019 11:18 AM UTC

Hi Mark 
  
Thanks for your update. 
  
We are able to reported issue ”SfMaskEdit Text is not cleared properly while resetting the Text” and confirmed this as defect and we will provide fix for the same on 5/07/2019. 
  
  
Also please confirm your current version. So that we can deliver the patch in your version. 
  
Regards 
Jagadeesan 



MA Mark June 27, 2019 11:53 AM UTC

I'm currently at version 17.1.0.38

Should I update to the latest version?


JP Jagadeesan Pichaimuthu Syncfusion Team June 27, 2019 12:06 PM UTC

Hi Mark, 
 
Thanks for confirming the current version. 
 
As we promised earlier, we will fix the reported issue and provide the patch for the same with 17.1.0.38 version on July 5th, 2019. 
 
We appreciate your patience until then. 
 
Regards, 
Jagadeesan 



JP Jagadeesan Pichaimuthu Syncfusion Team July 5, 2019 09:48 AM UTC

Hi Mark 
  
Thanks for your patience. 
  
The reported issue "SfMaskEdit Text is not cleared properly while resetting the Text" has been fixed and the patch can be download from the below links.   
   
Recommended approach - exe will perform automatic configuration.   
           
Please find the patch setup from below location:   
   
  
Please find the patch assemblies alone from below location:   
   
  

  
 
Assembly Version: 17.1.0.38 
           
Installation Directions:   
This patch should replace the files "Syncfusion.SfInput.WPF” under the following folder.       
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\[TargetFramework]             
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\17.1.0.38\precompiledassemblies\17.1.0.38 \4.5.1  
         
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you must manually copy and paste them to the preferred location or you must run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.            
   
   
Disclaimer:       
Please note that we have created this patch for version 17.1.0.38 specifically to resolve the issue reported in the Forum 145485. If you have received other patches for the same version for other products, please apply all patches in the order received.    
  
This fix will be included in our upcoming Volume 2 Sp1, 2019 release.  
   
Regards,  
Jagadeesan 



MA Mark July 8, 2019 03:18 AM UTC

Thank you very much for the patch, however, every time I try to download the .exe file, it reloads the page and displays a popup in the upper right corner and says "You are not authorized to download this patch.". Same goes with the zip files


JP Jagadeesan Pichaimuthu Syncfusion Team July 8, 2019 01:21 PM UTC

Hi Mark 
  
Sorry for Inconvenience caused. 
  
We have fixed the validation pop-up issue and fix for the issue included in below patch. Please try the below patch and let us know whether the reported issue is resolved at your end. 
  
Recommended approach - exe will perform automatic configuration.   
           
Please find the patch setup from below location:   
   
  
Please find the patch assemblies alone from below location:   
   
  
  
   
Assembly Version: 17.1.0.38 
           
Installation Directions:   
This patch should replace the files "Syncfusion.SfInput.WPF” under the following folder.       
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\[TargetFramework]             
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\17.1.0.38\precompiledassemblies\17.1.0.38 \4.5.1  
         
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you must manually copy and paste them to the preferred location or you must run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.            
   
   
Disclaimer:       
Please note that we have created this patch for version 17.1.0.38 specifically to resolve the issue reported in the Forum 145485. If you have received other patches for the same version for other products, please apply all patches in the order received.    
  
This fix will be included in our upcoming Volume 2 SP1, 2019 release.  
  
  
Regards, 
Jagadeesan 



MA Mark July 8, 2019 03:19 PM UTC

There's a MAJOR problem when the masked edit has a default value (which is required for my other masked edits since they allow me to edit an existing customer value for example), actually there's two:

1. There's a weird interaction when editing over the default value:
1.a. I can't type in between the letters
1.b. I can only type in front of the initial value
1.c. If I type a value in front and type in between the letters, the letter I typed will appear before the default value

2. Now let's say I've successfully removed the entire value on the masked edit using the process above, now the same problem persists wherein if I:
 2.a. Type a new value
 2.b. Press the reset button
 2.c. Type on top of the default text
The result is that it would do the append bug again.

Here's the code with the default value:

    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

        }
        private void SfMaskedEdit_Loaded(object sender, RoutedEventArgs e)
        {
            CustomerViewModel model = new CustomerViewModel();

            this.DataContext = model;
            model.NewCustomer.FirstName = "Default";
        }

    }

    public class CustomerViewModel: INotifyPropertyChanged
    {
        private Customer newCustomer;

        public CustomerViewModel()
        {
            NewCustomer = new Customer();
        }

        public Customer NewCustomer
        {
            get { return newCustomer; }
            set { newCustomer = value; RaisePropertyChanged("NewCustomer"); }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void RaisePropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }

        private ICommand resetcmd;

        public ICommand ResetNewCustomer
        {
            get
            {
                resetcmd = new DelegateCommand(Reset, CanReset);
                return resetcmd;
            }

        }

        private bool CanReset(object arg)
        {
            return true;
        }

        private void Reset(object obj)
        {
            NewCustomer = new Customer() { FirstName = "Default" };
            //NewCustomer = new Customer();
        }
    }

    public class Customer : INotifyPropertyChanged
    {
        private string firstName;
        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; RaisePropertycanged("FirstName"); }
        }

        //
        // Summary:
        //     Occurs when a property value changes.
        public event PropertyChangedEventHandler PropertyChanged;
        public void RaisePropertycanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
    }
 

Attachment: BugMaskedEdit_ff125d86.rar


MS Magesh Sankar Syncfusion Team July 9, 2019 01:23 PM UTC

Hi Mark 
  
Thanks for your update. 
Currently we are validating the reported issue at our end and will update more details on 10/07/2019. 
 
Regards 
Magesh S. 



JP Jagadeesan Pichaimuthu Syncfusion Team July 10, 2019 08:38 AM UTC

Hi Mark 
  
Thanks for your patience.   
  
Query 1: 
1. There's a weird interaction when editing over the default value: 
1.a. I can't type in between the letters 
1.b. I can only type in front of the initial value 
1.c. If I type a value in front and type in between the letters, the letter I typed will appear before the default value 
  
  
We are able to reproduce the reported issue and the reported cases is different from previous reported case which we provided fix. We will fix the new reported cases and provide the fix for the same on 17/07/2019. 
  
Query 2: 
2. Now let's say I've successfully removed the entire value on the masked edit using the process above, now the same problem persists wherein if I: 
 2.a. Type a new value 
 2.b. Press the reset button 
 2.c. Type on top of the default text 
The result is that it would do the append bug again. 
  
  
We have confirmed the patch which we provided in previous update fix the reported issue “old value appending issue”. Please find the video for the same. 
  
  
  
Please ensure from your side whether the provided patch is properly installed in your machine. 
  
  
Regards 
Jagadeesan


MA Mark July 11, 2019 04:51 PM UTC

No, the no.2 problem did go away after the fix IF the text box didn't have a default value and was blank BUT it's still very much present IF there's a default value since if I decided to type after resetting to the default value, it'll append previous texts again, you can clearly see it on the 0:58 mark wherein I placed the cursor in the middle of the word "Default" and pressed f, which made the new text absolutely bonkers. I pulled up an on-screen keyboard so you could see what I'm typing.


SP Subburaj Pandian Veluchamy Syncfusion Team July 12, 2019 10:39 AM UTC

Hi Mark,  
  
Thank you for your update.   
  
We can able to reproduce the reported issue and we will consider this case while fix the issue which reported in previous update and we will provide as consolidated patch for both the reported case on July 17, 2019. We appreciate your patience until then. 
 
Regards,
Subburaj Pandian V 
 



MA Mark July 12, 2019 04:23 PM UTC

Okay, thank you very much.


SP Subburaj Pandian Veluchamy Syncfusion Team July 15, 2019 09:24 AM UTC

Hi Mark,  
   
Thank you for the update. We will update you patch on July 17, 2019. We appreciate your patience until then.  
  
Regards,
Subburaj Pandian V  



JP Jagadeesan Pichaimuthu Syncfusion Team July 17, 2019 02:53 PM UTC

Hi Mark, 
 
Sorry for the delay. 
  
We are still working on the reported issue with high priority, when fixing this we are facing some complex issues which needs to be fixed and tested. We will provide the patch on the July 22nd, 2019.

We appreciate your patience until then. 
 
Regards, 
Jagadeesan 



KP Kanniyappan Panneer Selvam Syncfusion Team July 19, 2019 01:32 PM UTC

Hi Mark, 
 
Sorry for Inconvenience caused. 
 
On further analysis, the reported cases are working fine when using Value property instead of Text property of SfMaskedEdit which used in your application. Currently we are working to resolve the reported cases with text property. Meanwhile we suggest to use  Value property to resolve the reported issue. Please find the modified sample for the same. 
 
Code Snippet: 
<syncfusion:SfMaskedEdit MaskType="RegEx"  Mask="[0-9a-zA-Z]{0,20}" Width="255" Height="46"  
                                            Value="{Binding NewCustomer.FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"  /> 
 
 
 
 
Please try above solution and let us know whether the reported issue is resolved at your end. 
  
Regards, 
Kanniyappan P 


Loader.
Live Chat Icon For mobile
Up arrow icon