Skip to content
Version 2.32.0
↓ Get the launcher

InputElement.FocusRequest property

Opt-in: focus this field ON DEMAND, at any time (not just on window open like AutoFocus). The framework polls the returned number; whenever it CHANGES (the first value observed when the window is built never counts), the field takes keyboard focus the same way a click on it would, with the caret at the END of the text and nothing selected — so the user can keep typing. Typical use: an emoji/insert picker whose click would otherwise leave the field unfocused — keep an int, increment it in the click handler, and bind FocusRequest = () => _seq. While focused the game’s keyboard is suppressed as for any focused field; Esc/click-away release it. A request on a field that isn’t visible (collapsed ConditionalElement, hidden window) is dropped after a short wait rather than firing later. Default null = unchanged. Init property (NOT a ctor param) for binary compatibility.

public Func<int>? FocusRequest { get; set; }