WPF UserControls on ADXOlForms in ElementHost

Add-in Express™ Support Service
That's what is more important than anything else

WPF UserControls on ADXOlForms in ElementHost
Using hosted WPF UserControls causes unexpected transparency issues 
logjam




Posts: 15
Joined: 2011-06-22
I have a demo solution which reproduces these problem which can send.

2 projects in the solution.

One is a WPF UserControl library containing 3 basic controls (nothing much more than OK and Cancel buttons). Other is an ADX Outlook Addin project

Addin project contains 3 ADXOlForms. All are set to show on Explorer Reading pane; One Left, one Right and one Top. ADXOlForms for Right and Left Reading Panes contain ElementHost controls which host UserControls from the WPF UserControl library. ADXOlForm for Top Reading Pane just contains a label and standard OK button, and is included to demonstrate non-WPF behaviour.

All are cached OneInstanceForAllFolders and only show for Mail items. All are invisible by default, and they are displayed by clicking on ADXCommandBarButtons on an ADXExplorerCommandBar, one button for each form, which then sets Me.Visible to True in the relevant form's ADXBeforeFormShow event handler. Forms can be hidden again in 2 ways; either by toggling the ADXCommandBarButtons back to the Up state or by clicking on the OK and Cancel buttons on the forms themselves.

Everything works fine if the forms are shown and hidden one at a time. However, when the Right and Left Reading Panes are shown together, hiding one sometimes causes the other to go transparent. The ADXOlForm border still remains visible, but the WPF UserControl area becomes transparent. Also if both WPF forms are showing, and the non-WPF form is toggled on and off again, both WPF forms become transparent.

+

Another similar probably related problem is also produced when 2 dialogs are added to the Addin project. We add 2 buttons on to a ADXOlExplorerMainMenu control, and each button displays a dialog form (just a standard Windows Form with FormBorderStyle set to FixedDialog). One dialog contains an ElementHost to host a control from the WPF USerControl library. The other just contains standard Forms buttons to demonstrate non-WPF behaviour.

If the user clicks up the WPF dialog as soon as Outlook starts up (ie before any other forms in the Addin are displayed), the dialog itself displays as expected first time, but after that all WPF-based forms in the project show completely transparent. This only happens if the user opens the WPF dialog first. If other forms are opened first (including other WPF based forms) then this effect does not occur...

Very puzzling. I would appreciate if you can shed some light on it. Can I send you a demo project to illustrate?

regards
Posted 14 Sep, 2011 01:41:55 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Nicholas,

Sure. Please send a sample add-in project which can reproduce the issue to the support e-mail address (see readme.txt for details). I will test it on my PC with Outlook 2010 x64.

However, please note that we don't recommend using WPF on forms Add-in Express injects into Outlook UI. You can read more about this in the similar forum thread.

BTW What version and build number of Add-in Express do you use? Office? OS?
.NET, Extended MAPI, Windows Phone & RT
Posted 14 Sep, 2011 05:05:19 Top
logjam




Posts: 15
Joined: 2011-06-22
Hi Eugene,

Have sent demo to your support address.
Using v603 b3052 professional in VS2008.
OS is Vista Business and Outlook 2007.
Posted 14 Sep, 2011 05:21:26 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Nicholas,

Thank you. Please note that you use an old build of Add-in Express 2010. You can download the latest build from our web site.

Did you install the latest service packs for Visual Studio, Office and OS? Could you please tell me their build numbers and SPs installed?
.NET, Extended MAPI, Windows Phone & RT
Posted 14 Sep, 2011 05:38:03 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Nicholas,

Unfortunately I wasn't able to reproduce the issue on my PC with Outlook 2010 x64 (nor with Outlook 2007 SP2). Please make sure that you have all the latest service packs installed for Outlook, OS and Visual Studio (including .net framework) and, of course, you use the latest build of Add-in Express 2010.
.NET, Extended MAPI, Windows Phone & RT
Posted 14 Sep, 2011 06:02:09 Top
logjam




Posts: 15
Joined: 2011-06-22
Eugene,

Thanks. You're right, I am a bit behind with the versions and service packs.
Let me get it sorted out and I'll get back to you if I have further problems.
Posted 14 Sep, 2011 06:46:02 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Nicholas,

Please keep me notified.
.NET, Extended MAPI, Windows Phone & RT
Posted 14 Sep, 2011 06:51:40 Top
logjam




Posts: 15
Joined: 2011-06-22
Hi Eugene

I checked the OS/VS/Outlook versions but I think I was already uptodate.
If you can see anything obvious that needs updating please let me know.

OS Windows Vista Business Service pack 2

VS version 9.0.30729.1 SP
.Net framework 3.5 SP1
PresentationCore version 3.0.0.0
PresentationFramework version 3.0.0.0

Outlook 2007 (12.0.6562.5003) SP2 MSO (12.0.6562.5003)

I have updated Addin Express to latest build v604 b3056 pro

Unfortunately... I'm still getting exactly the same transparency effects....

Did you not get any problems with the demo at all? Even if you click the WPF Dialog menu button as soon as Outlook starts?

I really hope this can be sorted out because I just spent couple of months converting app to WPF thinking it was working fine.... I don't mind getting users to install Net Framework 3.5 (as per that previous forum post you pointed me to earlier.)
Posted 14 Sep, 2011 20:59:55 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Nicholas,

Unfortunately I wasn't able to reproduce the issue you faced with in one of my virtual PCs with Outlook 2007 SP2.

Could you please organize a remote session instead? I will take a look at the issue online.
.NET, Extended MAPI, Windows Phone & RT
Posted 15 Sep, 2011 03:15:53 Top
logjam




Posts: 15
Joined: 2011-06-22
Thanks Eugene.

I think I'm going to try and swap the UI around a bit instead and avoid using the forms in this way. Hopefully we can work around the problem. If I'm really stuck, then I will get back to you and we can set up something remotely.

Thanks again
Posted 15 Sep, 2011 06:32:42 Top