private void HandleEditorModeChangedMessage(EditorModeChangedMessage message) { if (message.EditorMode == EditorMode.XmlUtility) { // Since we don't know when this is called when compaired to a visual state change, queue up the work // on the UI thread after whatever's running UIThread.Queue(() => this.XPathTextBox.Focus()); } }