Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable highlighting on listbox but keep selection?

Tags:

wpf

xaml

listbox

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> 
like image 627
Aero Chocolate Avatar asked Dec 03 '10 08:12

Aero Chocolate


1 Answers

        <ListBox.ItemContainerStyle>             <Style TargetType="ListBoxItem">                 <Setter Property="IsSelected" Value="{Binding Content.IsSelected, Mode=TwoWay, RelativeSource={RelativeSource Self}}"/>                 <Setter Property="Template">                     <Setter.Value>                         <ControlTemplate TargetType="ListBoxItem">                             <ContentPresenter/>                         </ControlTemplate>                     </Setter.Value>                 </Setter>             </Style>         </ListBox.ItemContainerStyle> 
like image 85
Wayne Lo Avatar answered Oct 28 '22 20:10

Wayne Lo