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

Does the Xamarin.Forms version of SfDataForm support RegularExpressionAttribute?

The documentation for the Xamarin.Forms version of SfDataForm says that it supports RegularExpressionAttribute in the "Data annotations" section, but this type does not appear to be included in the SfDataForm NuGet package.

3 Replies

JN Jayaleshwari N Syncfusion Team January 24, 2019 10:28 AM UTC

Hi Chris, 
 
Thanks for contacting Syncfusion Support.  
 
We have checked the reported query “Does the Xamarin.Forms version of SfDataForm support RegularExpressionAttribute?” from our side. we regret to let you know that SfDataForm does not support RegularExpressionAttribute. We will remove and update our user guide documentation. 
 
Please let us know if you would require further assistance. 
 
Regards, 
Jayaleshwari N. 



CM Chris Marinacci January 25, 2019 07:09 PM UTC

Hi Jayaleshwari,

I was able to add the support myself by creating the file RegularExpressionAttribute.cs, below. You might want to consider adding this to your product.

Thanks,

Chris

using System;
using System.Text.RegularExpressions;

namespace Syncfusion.XForms.DataForm
{
    public class RegularExpressionAttribute : ValidationAttribute
    {
        private static String DefaultErrorMessageString => String.Empty;

        public String RegexString { get; }

        public RegularExpressionAttribute(String regexString)
            : base(() => DefaultErrorMessageString)
        {
            RegexString = regexString;
        }

        public RegularExpressionAttribute()
            : this(null)
        {
        }

        public override Boolean IsValid(Object value)
        {
            return new Regex(RegexString).IsMatch((String)value);
        }
    }
}


SG Swathi Gopal Syncfusion Team February 1, 2019 03:49 AM UTC

Hi Chris, 
 
We have checked your query with support for RegularExpressionAttribute in SfDataForm Xamarin.Forms and currently SfDataForm does not support RegularExpressionAttribute. Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts. We have added this feature request to our database. You can now track the current status of this feature request here. 
   
 
At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. 
 
Regards, 
Swathi G 


Loader.
Live Chat Icon For mobile
Up arrow icon