我有一个surfacelistbox如下
<s:SurfaceListBox x:Name="viewList" Height="200" Width="Auto" SelectedIndex="0"
ItemsSource="{Binding Source={StaticResource views}, XPath=Views/View}"
DisplayMemberPath="@Title"
SelectionChanged="viewList_SelectionChanged" Grid.Row="2" VerticalAlignment="Bottom" HorizontalContentAlignment="Stretch" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<s:SurfaceListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch"/>
</ItemsPanelTemplate>
</s:SurfaceListBox.ItemsPanel>
</s:SurfaceListBox>
我已经为 App.xaml 文件中的项目设置了如下样式
<Style TargetType="{x:Type s:SurfaceListBoxItem}">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}"
Color="#0071bc"/>
</Style.Resources>
<Setter Property="Height" Value="200"></Setter>
<Setter Property="Width" Value="480"></Setter>
<Setter Property="BorderThickness" Value="0,0,0,0"></Setter>
<Setter Property="Padding" Value="20,20,0,20"></Setter>
<Setter Property="Margin" Value="0"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="BorderBrush" Value="White"></Setter>
<Setter Property="FontSize" Value="57"></Setter>
<Setter Property="FontFamily" Value="TitilliumText22L"></Setter>
<Setter Property="FontWeight" Value="Bold"></Setter>
<Setter Property="TextBlock.TextAlignment" Value="Left"></Setter>
<Setter Property="TextBlock.HorizontalAlignment" Value="Stretch"></Setter>
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush>
<GradientStop Color="#3c3c3c" Offset="0"></GradientStop>
<GradientStop Color="#383838" Offset="0.6"></GradientStop>
<GradientStop Color="#6d6e6e" Offset="1"></GradientStop>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="BorderBrush" Value="#0071bc"></Setter>
<Setter Property="Background" Value="#0071bc"></Setter>
</Trigger>
</Style.Triggers>
</Style>
我的问题是,所选项目的背景颜色保持白色,而不是样式中描述的颜色。任何指针将不胜感激