ShellTreeListBox - Add an overlay icon when Folder contains files

Shell for WPF Forum

The latest build of this product (v25.1.0) was released 26 days ago, which was before this thread was created.
Posted 13 days ago by Ben Pottiez
Version: 25.1.0
Avatar

Hi,

I'm trying to figure out how I can add an overlay icon to a folder when that folder contains any files. This way our end users can have a visual feedback on what folders contain files.

I tried with a new ItemTemplate where I check the Children property, but this doesn't work: Children.Count = 0 until you open the folder and will only show subfolders, not files (CanIncludeFiles="False").

Any suggestions on how to accomplish are welcome!

Ben

Comments (1)

Posted 12 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Ben,

The ShellObjectItemAdapter.ChildrenQueryModeDefault property is set to TreeItemChildrenQueryMode.OnExpansion by default, which means it only populates children at all when you expand the node.  You could change that to OnDisplay instead to populate Children sooner. 

The "items" of a ShellTreeListBox control are ShellObjectViewModel objects, which effectively wrap IShellObjects.

Since CanIncludeFiles is false, it should have ShellObjectViewModel.Children.Count > 0 for any displayed folders that contain other folders.  But still will not tell you if files are present since those are filtered out from ShellObjectViewModel.Children by the CanIncludeFiles option.

The ShellObjectViewModel.Model returns the core IShellObject being examined though.  That has its own Children collection that should have the unfiltered results.  Perhaps you can examine that and see if any files are present.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.