How to disable highlighting on listbox but keep selection?

I am having trouble finding how to not allow my list box to highlight the item selected. I know that I didn't add a trigger to highlight the item. I'm still fairly new to WPF =)


<ListBox Name="CartItems" ItemsSource="{Binding}"
         ItemTemplate="{StaticResource TicketTemplate}" 
         Grid.Row="3" Grid.ColumnSpan="9" Background="Transparent"


Late answer, but there's a much better and simpler solution:

      <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
      <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
      <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />  

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).

Need Your Help

Name a PNG file saved from Canvas using an “open with” dialog

javascript html5 canvas

I am working with canvas and I would be able to save my Canvas to png.

Enable GZIP in jira

gzip jira atlassian

Is it ok to enable GZIP in jira?. in default GZIP compression is disabled in there any reason for that?. I have tested with the test server and it works fine and reduces the loading time

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.