WPF not redrawn when Outlook windows resizes

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

WPF not redrawn when Outlook windows resizes
 
Daniel Lang




Posts: 5
Joined: 2012-11-12
Hi,

I have a WPF control inside an ElementHost in an Outlook view region. Everything works great - I can resize the form using the splitter and the WPF control resizes smoothly as well. The problem is that when I resize the Outlook Window, the WPF control doesn't get redrawn / repainted and most parts are just white. When I minimize and restore the form region, everything looks good again.

Is there anything I can do to fix this behavior?

Thanks, Daniel
Posted 15 Dec, 2012 11:35:04 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Daniel,

I'm sorry for the delayed response; I suppose I overlooked your post somehow. What are Outlook version, service pack and bitness? And in what layout do you show your region? What Add-in Express version do you use?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Dec, 2012 07:24:25 Top
Daniel Lang




Posts: 5
Joined: 2012-11-12
Hi Andrei,

Thank you for your answer!

I'm using Outlook 2013, 32Bit on 64Bit Windows 8 Professional machine. I'm using the very latest Add-in Express version. I have the same problem on 3 different machines (all with that configuration, one with Office365 Preview version of Outlook). I also have a virtual machine with Windows 7 Pro 64Bit and Outlook 2010, 32Bit. It looks a little bit different there, but basically it's the same issue.

If you want to, I can send you the source code as well (but would need your email-address then).

Thanks, Daniel
Posted 18 Dec, 2012 07:49:53 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hi Daniel,

You can send the source code to the support email address; please find it in {Add-in Express}\readme.txt. Oh, please make sure that your email contains a link to this topic.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Dec, 2012 08:03:30 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hi Daniel,

I wasn't able to build your project but I was able to reproduce the issue with a simple add-in. The workaround is this:

private void ADXOlForm1_Resize(object sender, EventArgs e)
{
    this.elementHost1.Child = null;
    this.elementHost1.Child = this.userControl11;
}


Please note there are many issues when using WPF controls on a pane because the WPF core is partially incompatibile with Office GUI.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 18 Dec, 2012 10:42:55 Top
Daniel Lang




Posts: 5
Joined: 2012-11-12
Hi Andrei,

Thanks! That works very nice in Outlook 2013. In Outlook 2010 it has become better, but there are still 2 issues:
- Redrawing now works when the resize changed the height of the Outlook window but it does not when we only change the width
- As soon as I hover the collapse button with my mouse (no clicking) the panel disappear and draws weird stuff

I will try to fix this on my own and update this thread here. Only if I can't get it running, I'll send you an email.

Many thanks,
Daniel
Posted 18 Dec, 2012 11:12:58 Top
Daniel Lang




Posts: 5
Joined: 2012-11-12
I found the solution here: WPF Application Render Problem in ADXExcelTaskPane

The trick is to disable Hardware Acceleration for your WPF control. Once I did that, I had no issues in any Outlook version anymore.

Thank you guys!
Posted 18 Dec, 2012 12:46:14 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Daniel,

Thank you very much for posting the solution here!

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 19 Dec, 2012 00:22:23 Top