Bug 3/30: XAML Toolkit ComboBox Loses Selected Item

Posted on Sep 27, 2020

Bug 3 is MaterialDesignInXAML/MaterialDesignInXamlToolkit/FloatingHintComboBox looses hint.

The Material Design In XAML Toolkit attempts to provide a (WPF) XAML implementation of Google’s Material Design guidelines. As is probably clear from this website, design isn’t my strong suit. Like many programmers I am not alone in this and a dedicated UX team is not always available, even for larger projects, so frameworks that aim to make things look good and uniform are a great boon to the industry.

This bug report states that in the demo application, after selecting an item from a ComboBox dropdown, in some cases the selected item is removed from the dropdown as demonstrated below (the selected item is outlined in green, the missing item is outlined in red).

Selected Item Missing in Dropdown

I no longer have an active R# licence1, which would make XAML work easier, but I managed to find the bit of the application that is causing this to happen. There is a DependencyProperty that determines whether or not to show the selected item. It is prefixed with the following comment:

By default the selected item is hidden from the drop down list, as per Material Design specifications. To revert to a more classic Windows desktop behaviour, and show the currently selected item again in the drop down, set this attached property to true.

The way this is being done is actually quite nice, it is done in pure XAML with absolutely no code behind.

On seeing this and checking through the code to ensure that this was actually doing what it was supposed to I initially considered this to be the end of it. Bug closed: expected behaviour. However I decided to go and review the Material Design guidelines for myself to see if this was actually the case.

Material Design has no explicit ComboBox concept (as far as I can tell), they just talk about Menus. The documentation can be found here. After reading through the Menu documentation I was unable to find anything that specified that selected items should be removed from the list of options in the menu. Not only this, but the video they show of the Menu functionality shows the selected item remaining in the list.

So at this stage the bug is blocked. Either I’ve read the specification correctly and there is a bug in how the ComboBoxes render, or the original developer did and there is no bug. I’ve now left a comment on the bug and someone else will need to take a look to decide. Depending on the project maintainer’s decision I will either make the required updates or the bug is already closed.


  1. Until recently I considered R# to be indispensable, however Visual Studio has come a long way in recent years. There are still a lot of things R# does better, or does that it cannot do, but it seems to significantly slow Visual Studio down, so I’ve not renewed my license this year. ↩︎