Title:
WinUI 3: How can I detect user interaction with highlighted external controls and advance spoken step-by-step guidance?
Question:
I’m developing a Windows desktop application using WinUI 3, Windows App SDK, .NET 8, and Microsoft UI Automation.
The application is designed as an interactive step-by-step helper for people who may not be comfortable using a computer.
The intended experience is:
- The helper verbally tells the user what to do next, for example: “Click the Windows Start button. I’ve highlighted it for you.”
The application locates the real external Windows control using UI Automation.
A transparent, click-through topmost overlay highlights that control.
The user performs the action themselves. The application must never click, type, or perform the action for them.
The application detects that the user completed the requested action.
The helper verbally acknowledges completion and automatically speaks the next instruction.
The next appropriate control is highlighted.
This continues until the guided task is finished.
Our highlighting implementation currently obtains the UI Automation element's bounding rectangle and positions a transparent overlay around it.
The overlay uses:
WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_TOOLWINDOW
and the XAML overlay content has:
IsHitTestVisible = false
so the user should remain able to interact normally with the underlying application.
The current guidance implementation, however, is not sufficiently interactive.
For external actions it currently polls UI Automation approximately every 750 ms and determines completion primarily by checking whether a target disappeared or whether another expected UI element appeared.
For a number of external controls, completion is currently manual. The user has to return to our application and choose “I did this” before the next step becomes available.
That defeats much of the purpose of the application. The intended user may need the helper to actually talk them through the process rather than repeatedly reading instructions, performing an action, returning to the helper, and manually confirming completion.
The application already has an offline speech/voice system. The issue is not generating speech itself. We need to correctly connect external user interaction, guidance state progression, highlighting, and speech.
What is the recommended Windows architecture for implementing this type of event-driven guided interaction?
Specifically:
Can Microsoft UI Automation reliably notify our application when the user activates a UI element that we previously located and highlighted?
For buttons and links supporting InvokePattern, should we subscribe to UIA_Invoke_InvokedEventId / InvokePattern.InvokedEvent on the resolved element?
How should we detect user actions on controls that use other UI Automation patterns, such as SelectionItem, Toggle, ExpandCollapse, or text entry?
For text-entry steps, what is the recommended way to determine that the user has entered the expected text without our application taking control of the external program?
Should we combine UI Automation events with state/property-change events and use polling only as a fallback?
How should UI Automation event handlers be managed when the target element disappears and a new window/control appears as a result of the user's action?
Are there known issues with using a transparent topmost WinUI 3 overlay in combination with UI Automation event monitoring?
Is there a recommended state-machine/event pattern for safely doing:
locate target → highlight target → speak instruction → wait for user action → detect completion → acknowledge verbally → advance → locate/highlight next target → speak next instruction
The important requirement is that our application remains guidance-only. It should observe enough Windows UI state to know when the user completed a step, but the actual mouse click, keyboard input, selection, or other action must always be performed by the user.
We would appreciate guidance on the correct Microsoft UI Automation/WinUI 3 approach for building this reliably on Windows 11.Title:
WinUI 3: How can I detect user interaction with highlighted external controls and advance spoken step-by-step guidance?
Question:
I’m developing a Windows desktop application using WinUI 3, Windows App SDK, .NET 8, and Microsoft UI Automation.
The application is designed as an interactive step-by-step helper for people who may not be comfortable using a computer.
The intended experience is:
The helper verbally tells the user what to do next, for example: “Click the Windows Start button. I’ve highlighted it for you.”
The application locates the real external Windows control using UI Automation.
A transparent, click-through topmost overlay highlights that control.
The user performs the action themselves. The application must never click, type, or perform the action for them.
The application detects that the user completed the requested action.
The helper verbally acknowledges completion and automatically speaks the next instruction.
The next appropriate control is highlighted.
This continues until the guided task is finished.
Our highlighting implementation currently obtains the UI Automation element's bounding rectangle and positions a transparent overlay around it.
The overlay uses:
WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_TOOLWINDOW
and the XAML overlay content has:
IsHitTestVisible = false
so the user should remain able to interact normally with the underlying application.
The current guidance implementation, however, is not sufficiently interactive.
For external actions it currently polls UI Automation approximately every 750 ms and determines completion primarily by checking whether a target disappeared or whether another expected UI element appeared.
For a number of external controls, completion is currently manual. The user has to return to our application and choose “I did this” before the next step becomes available.
That defeats much of the purpose of the application. The intended user may need the helper to actually talk them through the process rather than repeatedly reading instructions, performing an action, returning to the helper, and manually confirming completion.
The application already has an offline speech/voice system. The issue is not generating speech itself. We need to correctly connect external user interaction, guidance state progression, highlighting, and speech.
What is the recommended Windows architecture for implementing this type of event-driven guided interaction?
Specifically:
Can Microsoft UI Automation reliably notify our application when the user activates a UI element that we previously located and highlighted?
For buttons and links supporting InvokePattern, should we subscribe to UIA_Invoke_InvokedEventId / InvokePattern.InvokedEvent on the resolved element?
How should we detect user actions on controls that use other UI Automation patterns, such as SelectionItem, Toggle, ExpandCollapse, or text entry?
For text-entry steps, what is the recommended way to determine that the user has entered the expected text without our application taking control of the external program?
Should we combine UI Automation events with state/property-change events and use polling only as a fallback?
How should UI Automation event handlers be managed when the target element disappears and a new window/control appears as a result of the user's action?
Are there known issues with using a transparent topmost WinUI 3 overlay in combination with UI Automation event monitoring?
Is there a recommended state-machine/event pattern for safely doing:
locate target → highlight target → speak instruction → wait for user action → detect completion → acknowledge verbally → advance → locate/highlight next target → speak next instruction
The important requirement is that our application remains guidance-only. It should observe enough Windows UI state to know when the user completed a step, but the actual mouse click, keyboard input, selection, or other action must always be performed by the user.
We would appreciate guidance on the correct Microsoft UI Automation/WinUI 3 approach for building this reliably on Windows 11.