<Window.Resources> <Style x:Key="_ListBoxItemStyle" TargetType="ListBoxItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <Border Name="_Border" Padding="2" SnapsToDevicePixels="true"> <ContentPresenter /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter TargetName="_Border" Property="Background" Value="Gray"/> <Setter Property="Foreground" Value="Yellow"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <ListBox x:Name="myListBox" ItemContainerStyle="{DynamicResource _ListBoxItemStyle}" Margin="0,20,0,30" VerticalAlignment="Top" Width="800" HorizontalAlignment="Right" MinHeight="200" ScrollViewer.HorizontalScrollBarVisibility="Disabled" SelectionChanged="myListBox_SelectionChanged" MouseDoubleClick="myListBox_MouseDoubleClick" Panel.ZIndex="2" BorderThickness="0" FontSize="15" Background="{x:Null}" HorizontalContentAlignment="Right"> </ListBox>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)