VSTO Outlook: Embed an WPF user control within a form region - outlook

Currently I have an WPF user control embedded within an Outlook custom task pane. The problem with the task pane is that you cannot remove the title bar so I was thinking about using a form region instead and reusing the existing WPF user control I already have. So, is it possible to embed an WPF user control within a form region? If so how.

You cannot add WPF controls directly to UI elements in Office solutions. Instead, add a User Control (WPF) item to your project, and use it as the design surface for WPF controls. Then, add the WPF user control to a UI element in your project. Visual Studio automatically creates an ElementHost object that hosts the WPF user control on the UI element. Or just add the ElementHost control to the user control and then configure it to host your WPF control.
Read more about that in the Use WPF controls in Office solutions article.

Related

VSTO Outlook: Use a form region or a custom task pane to implement a toolbar. Which best?

I want to create my custom toolbar at the top for explorer and inspector window. I want to make it ALWAYS visible. So which is the best approach, to use a custom task pane or a form region? Which best? What are the advantages and disavantages for each one?
The toolbar should be able to contain buttons, text fields, checkboxes, drop-down lists, etc.
There is no layout at the top for Outlook form regions.
Custom task panes is an Office-wide feature available in all Office applications (most of them to be precise). When you create a custom task pane for Outlook, the custom task pane is associated with a specific Explorer or Inspector window. Explorers are windows that display the contents of a folder, and Inspectors are windows that display an item such as an email message or a task.
Form regions are custom pieces of user interface that can be used to customize a standard form. They are not designed to customize the Explorer window, they are designed for item's forms. And created and designed only for Outlook.
You may also consider using Advanced Outlook view and form regions. They allows placing a form region at the top.

VSTO Outlook: Change border and header background color of custom task pane

I have an VSTO Outlook Add-in. I have put a custom task pane at the top. This custom task pane contains an WPF user control.Now I am trying to change the background color of the header (title bar) and borders of the custom task pane (I am not referring to the background of the WPF user control). Is it possible? If so how?
No, it is not. The Office extensibility model doesn't provide anything for that out of the box. You may try using the Windows API functions for that, at lease you can inject your own form. Such forms MS calls Adjucent Outlook windows. Note, you need to have a deep understanding of Windows API to move that way, see SetWindowsHookEx.
Also you may take a look at Add-in Express based form regions and views, see How to add a custom header to your Outlook form or task pane: C# and VB.NET for more information.

Widgets change places when running from design tab

I am building a visual studio application and have designed it using visual studio windows form. I am using the siticone library for the GUI but when i lay widgets out on the designer and then run the application all the widgets move. The buttons do not but the labs on them do. Also i have added a user control page that moves aswell. Please Help.
Cheers.enter image description here
Make sure that your Winform Font style and size match with all child controls including all Siticone controls.
Verify that you have anchored your controls accordingly on your form or panel control.

Replacing part of Outlook client's window with a custom form

I am developing a VSTO application for Outlook client. I am trying have my form open in the part of the Outlook client window which is highlighted in red in the following image:
I think I can't use the form regions because they replace the view for a single item.
So basically what I want to do is opening my custom form (windows or web) in the red area when I click my tool's button on the toolbar.
Any ideas how this can be done?
There are three main ways for displaying your own form there:
You can use the WebViewURL and WebViewOn properties of the Folder class for setting a web view state for the folder. Microsoft Outlook uses the rendering engine of the version Windows Internet Explorer installed on the client computer to display the web page. If Internet Explorer is not installed on the client computer, Outlook will not display the web page.
Create an adjucent Outlook window. See Creating Adjacent Windows In Outlook for more informaiton. Note, you need to have a deep understanding of Windows API to move that way, see SetWindowsHookEx.
Add-in Express provides a layout for the form out of the box. There is no need to invent a wheel in that case.
You will need to get down to the HWND level to insert your UI - see https://blogs.msdn.microsoft.com/stephen_griffin/2010/06/01/adjacent-windows-in-outlook/ and https://code.msdn.microsoft.com/OlAdjacentWindows/

How to add an application bar to a user control in wp7

I have built a wizard style user control that lets you add stackpanel based pages and flick between them.
I would like to add an application bar as part of the user control with next and previous buttons that enable/disable based on page displayed etc.
Application bar appears to be an attached property of PhoneApplicationPage. I have tried referencing Microsoft.Phone.Shell but get invalid type.
Any ideas how I can add it to my user control?
Application bar is such a pain in the a**. This control is not a Silverlight one but a native one. Maybe you can be more lucky with this solution:
http://blog.humann.info/post/2010/08/27/How-to-have-binding-on-the-ApplicationBar.aspx
The ApplicationBar is a service that is provided by the operating system, i.e. not part of the Framework, and can only be used at the page-level, not in your UserControl. In addition, the ApplicationBar does not support regular bindings as you've seen. As mentioned above there are a number of solutions that provide workarounds for this problem.
Alternatively, you could use the ApplicationBarButtonCommand and ApplicationBarButtonNavigation behaviors from the Silverlight Windows Phone Toolkit. It's a simple enough task to create your ApplicationBarMenuCommand if you need one.

Resources