iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I would like to format a text field while the User enters the information.Using xamarin.forms , I usa behavior , as explained in https://blog.xamarin.com/behaviors-in-xamarin-forms/.
How can I do with Crosslight
Sorry for the delay in sending this.
I created a simple Crosslight (Android) project which emulate the Email validator behavior. Following steps shows the detail:
public string NewText { get { return _newText; } set { if (_newText != value) { _newText = value; const string emailRegex = @"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$"; var IsValid = (Regex.IsMatch(_newText, emailRegex, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); if (IsValid) GreetingText = "Your email looks good"; else GreetingText = "Enter a valid email"; OnPropertyChanged("NewText"); } } }
using Intersoft.Crosslight; using Intersoft.Crosslight.Drawing; using System; using System.Globalization; namespace EmailValidator.Converters { public class TextStyleConverter : IValueConverter { #region IValueConverter implementation public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { var styles = new StyleAttributes(); if (value.ToString() == "Your email looks good") styles.ForegroundColor = Colors.Green; else styles.ForegroundColor = Colors.Red; return styles; } return value; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotSupportedException(); } #endregion } }
this.AddBinding("GreetingLabel", BindableProperties.StyleAttributesProperty, new BindingDescription("GreetingText") { Converter = new TextStyleConverter() });
I enclosed the simple Android project (as attachment) for your reference. Hope this helps.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname