WPF Combobox flickering when DPI 150% and on ElementHost

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

WPF Combobox flickering when DPI 150% and on ElementHost
 
Rhys Hicks




Posts: 16
Joined: 2021-01-21
Hi,

Coming across an issue with our application.

Setup
Add-in Express taskpane (that has AutoScale set to DPI), with a WinForms `ElementHost` control that hosts a WPF app inside.


Issue

The issue we are having is that when a computer has multiple monitors and one of them has a scaling set to 125%/150% (Right Click Desktop > Display Settings > Scale and Layout) we have issues with few of our controls, specifically our combobox flickering. We see this a lot when a user has a laptop and 2nd monitor screen.

Essentially when you hover over the combobox with the mouse it flickers and jumps about when trying to select an item. For what its worth here's a gif of the behaviour we're experiencing: https://imgur.com/a/LyyfPoR.

Has anyone see anything like this when writing WPF apps using the Add-In Express taskpane?

Thanks
Posted 26 Jan, 2023 11:53:37 Top
Andrei Smolin


Add-in Express team


Posts: 18878
Joined: 2006-05-11
Hello Rhys,

We haven't seen such an issue. Could you create a simple project demonstrating the issue and send the project to the support email address; find it in {Add-in Express installation folder}\readme.txt; please make sure your email contains a link to this topic.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Jan, 2023 06:17:34 Top
Rhys Hicks




Posts: 16
Joined: 2021-01-21
Hi Anrdrei,

Currently in the process of doing this now. Oddly it seems with a vanilla combobox (so no styling) it does not present this issue. I will hopefully have something for you shortly.
Posted 02 Feb, 2023 05:48:41 Top
Rhys Hicks




Posts: 16
Joined: 2021-01-21
Hi I managed to recreate it and have sent it over to support.

For anyone else coming across this post, https://www.add-in-express.com/forum/read.php?FID=5&TID=16225 has a more detailed answer, but essentially assigning
 System.Windows.Threading.Dispatcher.CurrentDispatcher
to a class field within the
 AddinModule_AddinInitialize
event causes this issue.
Posted 03 Feb, 2023 11:04:21 Top
Andrei Smolin


Add-in Express team


Posts: 18878
Joined: 2006-05-11
Thank you very much, Rhys!

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 06 Feb, 2023 06:59:07 Top
Rhys Hicks




Posts: 16
Joined: 2021-01-21
Hi,

Just wondered if the support team had any updates on this issue?

Thanks
Posted 08 Mar, 2023 07:28:34 Top
Andrei Smolin


Add-in Express team


Posts: 18878
Joined: 2006-05-11
Hello Rhys,

Please forgive me. Turns out I responded to someone else about this issue thinking that I respond to you.

There's nothing that we could fix in this area. Also, System.Windows.Threading.Dispatcher doesn't seem to be a simple topic and we have no experience with it. We think that the idea mentioned in https://www.add-in-express.com/forum/read.php?FID=5&TID=16225 - i.e. switching to using the SendMessage/OnSendMessage machinery that Add-in Express provides - this idea is a way to follow.

I would also check whether OnRibbonBeforeCreate occurs before AddinInitialize in your case. If it is, I'd try to initialize your class field in OnRibbonBeforeCreate.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 09 Mar, 2023 08:39:56 Top