Issue
On my page, I'm using a picker that bound an ItemSource to 3 selectable items. When I select something from the list or cancel it, the focus stays on the picker and that allows me to type something. Although this does not affect the value selected, it can be confusing to the user Is there an easy way to prevent a user from entering data in this field?
Solution
Solution (or a work around) is disabling focus using a custom renderer:
internal class CustomPicker : PickerRenderer
{
public CustomPicker(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
{
base.OnElementChanged(e);
EditText?.SetFocusable(ViewFocusability.NotFocusable);
}
}
Answered By - Cfun
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.