UWP Custom control: Expandable Row ListView

I was working on a Universal Windows Platform app where I needed a ListView whose rows can be expanded to reveal further data underneath it. I think these controls are called DataRowTables in Web UI programming. So, I decided to write one.

ExpandableRowListView usage animation

To use it, you can either bind its ‘ItemsSource’ to an ‘IEnumerable<ExpandableRowListViewItem>’ or add static items in XAML or add static items in code using ‘ExpandableRowListView.Items.Add(…)’ method. These usages are shown in the project containing the source code.

Source code

Advertisements

Pellucid Icons – Transparent Windows Desktop Icons

Pellucid Icons - allows your desktop icons to be semi/transparent so that it doesn't occlude your wallpaper
Pellucid Icons – allows your desktop icons to be semi/transparent so that it doesn’t occlude your wallpaper

So, you have a beautiful wallpaper on your desktop but there’s a barrage of programs and document icons occluding it – ’cause all play and no work makes Jack a dull boy. What to do? Well, here’s a solution.

Pellucid Icons is a shell extension for Explorer that makes your icons transparent until you perform an activity such as mouse move, mouse move to one-third of the screen or double click. Scroll to the bottom for installer.

The extension is implemented with two COM shell extensions in it. One is an icon overlay handler. We (ab)use this handler to make Explorer load our DLL into its address space as soon as possible. The other is a context menu handler. We use this handler to add sub menu items to the context menu when users right click on the desktop.

Once Explorer has mapped our DLL into its address space, we can find the ListView control responsible for desktop icons using ‘FindWindow()’ and set its transparency using ‘SetLayeredWindowAttributes()’. Of course, we need to set ‘WS_EX_LAYERED’ attribute for this ListView before we can set transparency. This attribute is can be applied to child windows only if the application is running in the operating system context of Windows 8 or greater. Notice, that I didn’t say ‘run(ning) in’ but ‘run(ing) in operating system context’. Even though, you may be running your application in Windows 8, it may be running in context of Windows Vista. For normal applications, you need to embed a manifest with ‘supportedOS’ tag to make it run in Windows 8 context. Windows Explorer executable doesn’t have this manifest. Yet, using task manager (in Details tab, you need to right click the header->Select columns… and check Operating system context) we can see that the OS has decided to run it in the context of Windows 8.1 (my test machine’s OS). Phew, we wouldn’t want to make changes to Explorer image file in any way but I wonder how this works? Is this hard coded into the OS? If you have any info regarding this, please do comment.

In order to make Windows Explorer invoke our context menu for the desktop, we need to register it at ‘HKEY_CLASSES_ROOT\DesktopBackground\shellex\ContextMenuHandlers’. Easy peasy. But our context menu handler is invoked even when the user right clicks on an Explorer folder window showing files in user’s Desktop. This is a minor annoyance but fortunately we can detect whether the user right clicked on the actual Desktop or a folder window by checking the flag parameter in ‘IContextMenu::QueryContextMenu(…)’ for ‘CMF_EXPLORE’ (0x4L). If this flag is set, its a folder window so we exit the method without adding anything else we add our menu.

Minimum supported OS: Windows 8

License: Freeware, Open Source, Author disclaims any liability
Credit: Icon from FlatIcons.com, function ‘Utility::Create32BitHBITMAP()’ is lifted from TortoiseSVN project, context menu handler code template is from Microsoft and installer from InnoSetup

Source code

Download installer
Supported architecture for installer: 64-bit machine, for 32-bit machine you’ll have to build yourself
NOTE: This program is installed for all users in your computer but the installer activates it only for the user who ran the installer. Other users in the computer can activate this program by right clicking on their desktop then checking the option ‘Pellucid icons->are enabled’.