Xamarin Forms Custom Entry Renderer in Syncfusion SfTextInputLayout FocusChange
 

public class CustomEntryRenderer : EntryRenderer
{
	public CustomEntryRenderer(Context context) : base(context) { }
	
	CustomEntry CurrentElement => Element as CustomEntry;

	private EditText native = null;
	private Android.Views.View.IOnFocusChangeListener focusListener = null;

	protected override void OnElementChanged(ElementChangedEventArgs e)
	{
		base.OnElementChanged(e);

		if (e.OldElement == null)
		{
			Control.Background = null;

			native = Control as EditText;
			this.focusListener = Control.OnFocusChangeListener;

			Control.FocusChange += Control_FocusChange;
		}

	}

	void Control_FocusChange(object sender, FocusChangeEventArgs e)
	{
		if(this.focusListener != null)
			this.focusListener.OnFocusChange(native, e.HasFocus);

		if (e.HasFocus)
			CurrentElement.Focused?.Execute(CurrentElement);
		else
			CurrentElement.Unfocused?.Execute(CurrentElement);
	}
}


 

Author: Engin ATALAY
Date: 16.06.2022 13:36:32
View Count: 1220
 
 

COMMENTS
 
No comments yet. Be the first to comment who you are.
 
 
 
 
 
 
 
WRITE COMMENT
 
 
Your Name :
 
 
 
E-mail :
 
 
 
Your Message :
 
 
 
 
 
 
 
This project : ASP.NET MVC , RAZOR, Entity Framework , CSS , HTML , JQUERY(2.0.2) , AJAX the C# side-tier architecture was developed with logic.
 
Yukarı Çık