That sounds like a tricky one!
When you create a Custom Task Pane via Excel-DNA, it is only involved
in the initial hookup, to do the on-demand COM registration. Excel-DNA
has no involvement or interference in the CTP as it runs - no wrappers
or anything in between. Perhaps VSTO has some wrapper code that might
make it integrate better - you might discover this by poking around
the VSTO library with ILSpy a bit, and then implement the same code in
There used to be some issues with WPF being hosted in Office apps, but
I have no experience myself or a nice reference at hand. Before you do
the complicated-sounding VBA/COM updating, just check whether you can
update the content of your CTP fast enough from a timer or something.
I don't really understand your update loop - it might be that you are
just doing too much work on the main thread. DoEvents is pretty much a
red flag to me. The interaction between Excel's ScreenUpdating and how
the CTP is hosted is a mystery, but maybe someone on the Excel for
Developers forum might ahve some ideas.
So my suggestion would be:
- If you really see a difference between Excel-DNA and VSTO, then it
is due to code that is in the VSTO libraries setting some confguration
or doing something clever to the UserControl. Excel-DNA is not
involved in the WPF/CTP drawing path at all.
- Make an example of a WPF form outside Excel, which matches the
content that you want to draw, and check that you can update it at the
rate you require. WPF has a million tuning options, like bitmap
caching, that can make a huge difference to its performance.
- Next, make a WPF/CTP that displays the content and is updated from a
timer or something - no VBA/COM or Excel involved in the updates, just
hosted in Excel. This will test the hosting in the WinForms host and
Excel, and give you confidence that the message loops and display
environment doesn't mess anything up.
- Next, update the data from .NET code in your add-in, allowing you to
figure out any threading issues, since your updates will probably be
generated on a secondary thread, and you need to update the WPF
controls on the main thread.
- Finally, consider you to hook up the real data.
On Jun 29, 10:25 am, aberglas <aberg...@gmail.com> wrote: