You can see the animations based on the triggers when items are selected, and the remove button (the X, it’s the WingDings font “r”) is also displayed by changing it’s opacity. One thing to note is that the btnRemove has the tag property set to the binding. I’ll cover this below in more detail but it’s needed to determine what item the user is working with.

Each ListBox is shown below. lstRoots is the first ListBox that gets the root words, and lstResults is the ListBox that gets the newly created words.

Note that each ListBox hooks the RoutedEvent for the ButtonBase.Click? Since the button is in the template and used for both lists I didn’t want to call an event from it or we would also need to determine which list was the caller. This way we can respond to the event easier and it keeps the template clean.

When a result is generated from a word it can match one of three items:

a merged word

used a prefix

used a suffix

This is necessary because of the filters (CheckBoxes). When a filter is selected we need to know how the word was generated so we can filter it. So I created a small Word class:

Notice in that code for removal we access the Tag. Remember earlier in the XAML we bound the current item to the tag property? Now we can retrieve it easily and know which item the user clicked in the list.

Modifying the selection in a WPF ListBox is simple enough to do but as you see can change the feeling of the application. Imagine if I just left the app with the default highlight on selection? Would the user experience be the same? Obviously not, the little things such as this can really resonate with your users. I hope you enjoyed this project and can find a use for this in your code.