CATEGORIES
>>
Dart(2)
>>
Errors(5)
>>
Android(11)
>>
Errors(1)
>>
Errors(2)
>>
Windows 8(3)
>>
iPhone7(1)
>>
Errors(4)
>>
Html(1)
RECOMMENDED SITES
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.