Set Focus on a control

When a new dialog is shown, and the default focus should be on the control, an explicit set focus will be needed.

To make calls to the input event, you can set a context variable that is bound to the Input Event property to a string that starts with SetFocus and followed by a random element to ensure that the app detects it as a change.

Example Power Fx formula that triggers the focus behavior:

UpdateContext({ ctxComponentEvent: "SetFocus" & Text(Rand()) });

The component's InputEvent property would then be bound to the context variable ctxComponentEvent.


Text(Rand()) is used to generate a unique value for the ctxComponentEvent. A unique value change is required to trigger an event in the component.