Search code examples
c#wpfui-automationmicrosoft-ui-automation

Modal dialogs causing UI automation to hang


I'm trying to implement UI automation in a WPF application but whenever a modal dialog appears the UI automation will hang until the dialog is manually closed.

So far I've tried using a second thread to close the dialog box, setting the application to use MTA threads, using RaiseEvent to raise the Button.ClickEvent on the button to close the dialog, and using sendinput to send a keypress to the dialog. None of these methods are working and I haven't found any other workarounds to try.

Does anyone know of any possible solutions?


Solution

  • Give ChildWindow a shot: http://wpftoolkit.codeplex.com/wikipage?title=ChildWindow&referringTitle=Home