I am having trouble finding how to not allow my ListBox to highlight the item selected. I know that I didn't add a trigger to highlight the item.
<ListBox Name="CartItems" ItemsSource="{Binding}"
ItemTemplate="{StaticResource TicketTemplate}"
Grid.Row="3" Grid.ColumnSpan="9" Background="Transparent"
BorderBrush="Transparent">
</ListBox>
Late answer, but there's a much better and simpler solution:
This allows you to have a LisBox that looks just like an itemscontrol, but has support for selection.
Edit: How it works
This alters "colors of the system", in other words your windows theme, only for this ListBox and its children (we actually want to target the
ListboxItem
).For example hovering a
ListboxItem
usually gives it a deep blue background, but here we set it to transparent (HighlightBrushKey).Edit (30 June 2016):
It seems for latest Windows version this is not enough anymore, you also need to redefine
InactiveSelectionHighlightBrushKey
Thanks to @packoman in the comments
In the Properties tab, there is an Enabled Field with 2 options, true and false. By turning this to false, the Listbox remains white and selection is not avaliable. Just figured this out!
I'm talking about a trick I did in my WP8 app.
I added a transparent frame image above it (the image's border was seen, think of it like a picture frame). The scroll was functional, any manipulation event was firing just that the Listbox items weren't selected anylonger.
I guess this could work with a full transparent image set to Fill as well.
removing the highlighting completely feels very odd, as you dont know if you've selected anything, but here's a version of the control template that uses
WhiteSmoke
(which is very subtle) instead ofBlue
You will have to re-template
ListBoxItem
. In the default template, it has a trigger that highlights itself whenIsSelected
property istrue
. You just have to create a template that does not have that trigger.