I’m working on an XBAP app where Users primarily use the Keyboard for Navigation. When I display a MessageBox, I can hit Enter to close it but then the main application doesn’t seem to regain focus. I have to manually click the mouse on the screen to put focus back on the application.
Is there a way around this?
Edit
I can verify that the app still has Logical Focus, but it just doesn’t have Keyboard Focus
I found a hack that works, although I don’t like it because I feel it ties my Views to my ViewModel
I’m using an IsFocused AttachedProperty to bind a control to a boolean property behind the View. The same View is also subscribing to a
DisplayErrorevent that displays aMessageBoxerror and reset theIsFocusedproperty afterwards so it updates the UI. Last change made was to update my ViewModels to publish errors to theEventAggregatorinstead of handling themselves with aMessageBox, which is probably better anyways.I suppose it works, even if I don’t like it