Advertisement
Advanced .NET MAUI, Forms, Input & Validation

How do you manage focus and keyboard behavior in forms?

Short answer

Call Focus()/Unfocus() to move focus programmatically (e.g., advance on Entry Completed), use ReturnType to set the keyboard's action key, and adjust for the on-screen keyboard with the platform's soft-keyboard handling (KeyboardScrollView patterns or Android…

Save .NET MAUI mock interview
Advertisement
AModel answer
Call Focus()/Unfocus() to move focus programmatically (e.g., advance on Entry Completed), use ReturnType to set the keyboard's action key, and adjust for the on-screen keyboard with the platform's soft-keyboard handling (KeyboardScrollView patterns or Android windowSoftInputMode). Ensure the focused field stays visible.
<Entry ReturnType="Next" Completed="OnNameCompleted" />
void OnNameCompleted(object s, EventArgs e) => emailEntry.Focus();
Real-world example
Pressing Next on the name field jumps focus to the email field, streamlining form entry.
Likely follow-ups
  • How do you keep the focused field visible? | What does ReturnType do?
Related topics