Sie können dies tun, indem Sie die vorhandene Steuervorlage für ein ListBox-Element anpassen. Der einfachste Weg, dies zu tun, ist, Expression Blend zu starten, mit der rechten Maustaste auf ein ListBoxItem zu klicken, zu Edit Control Parts (Template) zu gehen und Edit a Copy... zu wählen und dann die Füllfarbe der fillColor- und fillColor2-Rechtecke wie gewünscht anzupassen.
Das folgende Xaml stellt die ListBoxItem-Mauszeigerfarbe auf transparent und die ausgewählte Farbe auf hellgrün ein, aber Sie können dies an Ihre Bedürfnisse anpassen:
<UserControl x:Class="SilverlightApplication2.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
Width="400" Height="300" Background="#FF000000">
<UserControl.Resources>
<Style x:Key="ListBoxItemStyleTransparent" TargetType="ListBoxItem">
<Setter Property="Padding" Value="3"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="VerticalContentAlignment" Value="Top"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="TabNavigation" Value="Local"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid Background="{TemplateBinding Background}">
<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="CommonStates">
<vsm:VisualState x:Name="Normal"/>
<vsm:VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="fillColor" Storyboard.TargetProperty="Opacity">
<SplineDoubleKeyFrame KeyTime="0" Value=".35"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="contentPresenter" Storyboard.TargetProperty="Opacity">
<SplineDoubleKeyFrame KeyTime="0" Value=".55"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="SelectionStates">
<vsm:VisualState x:Name="Unselected"/>
<vsm:VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="fillColor2" Storyboard.TargetProperty="Opacity">
<SplineDoubleKeyFrame KeyTime="0" Value=".75"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="FocusStates">
<vsm:VisualState x:Name="Focused">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Unfocused"/>
</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
<Rectangle x:Name="fillColor" IsHitTestVisible="False" Opacity="0" RadiusX="1" RadiusY="1" Fill="Transparent"/>
<Rectangle x:Name="fillColor2" IsHitTestVisible="False" Opacity="0" Fill="#FF00FF00" RadiusX="1" RadiusY="1"/>
<ContentPresenter HorizontalAlignment="Left" Margin="{TemplateBinding Padding}" x:Name="contentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
<Rectangle x:Name="FocusVisualElement" Visibility="Collapsed" Stroke="#FF6DBDD1" StrokeThickness="1" RadiusX="1" RadiusY="1"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<ListBox x:Name="ListBoxTest">
<ListBoxItem Content="Some String" Style="{StaticResource ListBoxItemStyleTransparent}" />
</ListBox>
</Grid>
</UserControl>
Das fillColor-Rechteck gibt die Farbe an, die verwendet werden soll, wenn der Benutzer mit der Maus über ein ListBoxItem fährt. Im obigen Code habe ich dies auf Transparent eingestellt, so dass keine Farbe angezeigt wird, wenn Sie mit der Maus über das ListBoxItem fahren.
Die fillColor2 gibt die Farbe an, die verwendet werden soll, wenn ein ListBoxItem ausgewählt wird. Im obigen Code habe ich #FF00FF00 angegeben, damit die Farbe hellgrün ist, wenn ein ListBoxItem ausgewählt ist.
In Ihrem Fall würden Sie die Fill-Eigenschaft des fillColor2-Rechtecks auf Transparent setzen, um keine Farbe zu simulieren, wenn der Benutzer ein Element auswählt.