Search code examples
objectlistviewexcel-dna

ObjectListView.TreeListView does not expand nodes in Excel-DNA CustomTaskPane


I have made a user control with a TreeListView control in it. This works fine when placed in a Winforms app, but when used in a CustomTaskPane in Excel it will not expand the nodes when the + sign is clicked.

The underlying model expands correctly when I manually call ExpandAll, so it seems that CanExpandGetter and ChildrenGetter work correctly, but for some reason the + sign will not work.

I have also assigned an Imagelist to SmallImageList.

Is there some Winforms voodoo that I should know about that might prevent this from working? The Control derives from UserControl and is ComVisible. I have used normal treeview in TaskPanes and they work fine, so there seems to be something special with the combination TreeListView and ExcelDNA.CustomTaskPane..

I can mail the sample project to reproduce on request.


Solution

  • It's not well documented -- note the subtle use of understatement :) -- but there is a magic switch for this:

    On the "What's New" page, there is this note:

    Added CanUseApplicationIdle property to cover cases where Application.Idle events are not triggered. In some contexts – specifically VisualStudio and Office extensions – the Application.Idle events are never triggered. If you set CanUseApplicationIdle to false, ObjectListView will correctly handle these situations.