none
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.

    However...

    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? 

    Regards,

    Sai


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

Answers

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.

    Problem:-

    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 http://books.google.com/books?id=Jp8qWFtiSl0C&pg=PA110&lpg=PA110&dq=outlook+form+region+delete+in+reading+pane&source=bl&ots=heBb06FCba&sig=J1SFD9xgpLWNj3BVHW7QqsjTOl8&hl=en&sa=X&ei=_IQ1U7epGO7QsQSo8IGIBg&ved=0CEMQ6AEwBA#v=onepage&q=outlook%20form%20region%20delete%20in%20reading%20pane&f=false 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
    Moderator
  • 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