WPF form in VSTO Outlook Add-In - Space bar advances to next mail RRS feed

  • Question

  • I have a VSTO (.net 4) Outlook Add-In which opens a WPF form.

    There are a number of controls on the form, including 2 textboxes.

    If I open the form when I have an email selected (with focus) in the Email Explorer then everything works as expected.


    If I open the form when I have given any email focus by clicking on the email body (ie the message itself) then the textboxes on my form won't accept the space key,tab key or key combinations such as Ctrl+C, Ctrl+V. If, for example, hitting Space then Outlook (in the background) cycles to the next email.

    Could you please help me out from this issue? 



    • Edited by Sai Prathap Tuesday, September 16, 2014 1:05 PM
    Tuesday, September 16, 2014 1:04 PM


All replies

  • Hello Sai,

    Is it an Outlook form regions? Where do you host WPF controls?

    Try to turn off the Single key reading using the space bar option in Outlook which allows you to move quickly through your messages in the Reading Pane. The space bar scrolls the current item. At the end of the item, it jumps to the next unread item in your message list.

    Does it help?

    Tuesday, September 16, 2014 1:44 PM
  • Thank you.

    It is not the Outlook form region. I have created a custom ribbon,When I click on it(button) will open a WPF Form.

    Even I have unchecked the single key reading using space bar option,but my problem is not solved.


    I have encountered the issue with the following steps

    1.Select any Mail in the inbox

    2.Select the text(focus) with the mouse in mail body/subject

    3.Click on ribbon/button,will open wpf form contains differnt controls

    4. click on textbox and keydown anykey (a,b,c..) will display the keys in the texbox but when press spacebar instead of display space in the text box at the background the previously selected mail content scroll bar advances to next and further move to next mail.

    5.Even when any control select in the form and press Tab will open outlook window and Tab operataion will perform there instead of focus on the next control in add-in form.

    So when user select any text in the mail and open addin form causes to Spacebar and Tab's are not working in the Form even though Form is activated. And at the background spacebar and Tab functionalities (shortcut func)are working for outlook.

    Please Please help me out from this issue.

    Thank you for your support.

    • Edited by Sai Prathap Wednesday, September 17, 2014 1:22 PM
    Wednesday, September 17, 2014 12:39 PM
  • Outlook has a habit of swallowing various keys and not sending them along to your code or form region. The spacebar, tab, backspace keys are among those affected when the keys are pressed in the reading pane. See for some additional information.

    The summary is make the controls read-only unless the item is opened.

    About the only way around this is to set up a global message hook and handle the key presses yourself. Of course that's not an easy or simple task, but it can be done.

    Ken Slovak MVP - Outlook

    Wednesday, September 17, 2014 2:37 PM
  • This is a known issue in Outlook. You may try to open a support case. But I don't think it will help in that case. Everybody writes an additional code, as Ken mentioned, to bridge the gap and avoid such issues.
    Wednesday, September 17, 2014 6:21 PM