Skip to content

Instantly share code, notes, and snippets.

@Char0394
Created October 26, 2017 22:13
Show Gist options
  • Select an option

  • Save Char0394/50b54b83e28f234d523f1cb1cb0a5ebe to your computer and use it in GitHub Desktop.

Select an option

Save Char0394/50b54b83e28f234d523f1cb1cb0a5ebe to your computer and use it in GitHub Desktop.
[assembly: ExportRenderer(typeof(ExtendedEntry), typeof(ExtendedEntryRenderer))]
namespace EntryValidationBorder.iOS
{
public class ExtendedEntryRenderer : EntryRenderer
{
protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
if (Control == null || this.Element == null) return;
if (e.PropertyName == ExtendedEntry.IsBorderErrorVisibleProperty.PropertyName){
if (((ExtendedEntry)this.Element).IsBorderErrorVisible)
{
this.Control.Layer.BorderColor = ((ExtendedEntry)this.Element).BorderErrorColor.ToCGColor();
this.Control.Layer.BorderWidth = new nfloat(0.8);
this.Control.Layer.CornerRadius = 5;
}
else
{
this.Control.Layer.BorderColor = UIColor.LightGray.CGColor;
this.Control.Layer.CornerRadius = 5;
this.Control.Layer.BorderWidth = new nfloat(0.8);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment