Wpf ListViewItem在选择时闪烁

Wpf ListViewItem在选择时闪烁,wpf,Wpf,亲爱的StackOverflow用户,一天中的好时光!因此,我有以下ListView的XAML代码: <ListView Name="texturepacks_list_wpf" Background="Transparent" HorizontalAlignment="Left" Height="150" Margin="225,171,0,0" VerticalAlignment="To

亲爱的StackOverflow用户,一天中的好时光!因此,我有以下ListView的XAML代码:

<ListView Name="texturepacks_list_wpf"
          Background="Transparent"
          HorizontalAlignment="Left"
          Height="150"
          Margin="225,171,0,0"
          VerticalAlignment="Top"
          Width="320"
          BorderThickness="0">
  <ListView.Resources>
    <ControlTemplate x:Key="SelectedTemplate"
                     TargetType="ListViewItem">
      <Grid Margin="0, 2, 0, 2">
        <StackPanel Orientation="Horizontal"
                    Height="30"
                    Width="305"
                    Background="{TemplateBinding Background}">
          <StackPanel.BitmapEffect>
            <!--<DropShadowEffect Color="#7c3c9a" Direction="320" Opacity="1" ShadowDepth="0"></DropShadowEffect>-->
            <OuterGlowBitmapEffect GlowColor="#7c3c9a"
                                   GlowSize="5"
                                   Noise="0" />
          </StackPanel.BitmapEffect>
          <Grid Width="5"></Grid>
          <Image Source="{StaticResource ResourceKey=texturepack_icon}"
                 Height="24"></Image>
          <Grid Width="20"></Grid>
          <Label Content="{Binding TexturepackName}"
                 Style="{StaticResource ResourceKey=PTSansBold}"
                 Foreground="#FFF"
                 FontSize="20px"
                 VerticalContentAlignment="Center"></Label>
        </StackPanel>
      </Grid>
    </ControlTemplate>
  </ListView.Resources>
  <ListView.BorderBrush>
    <SolidColorBrush Color="#000"
                     Opacity="0"></SolidColorBrush>
  </ListView.BorderBrush>
  <ListView.ItemContainerStyle>
    <Style TargetType="ListViewItem">
      <Setter Property="Background">
        <Setter.Value>
          <SolidColorBrush Color="#261635"
                           Opacity="1"></SolidColorBrush>
        </Setter.Value>
      </Setter>
      <Setter Property="Padding"
              Value="5" />
      <Setter Property="Template">
        <Setter.Value>
          <ControlTemplate TargetType="ListViewItem">
            <Grid Margin="0, 2, 0, 2">
              <StackPanel Orientation="Horizontal"
                          Height="30"
                          Width="305"
                          Background="{TemplateBinding Background}">
                <Grid Width="5"></Grid>
                <Image Source="{StaticResource ResourceKey=texturepack_icon}"
                       Height="24"></Image>
                <Grid Width="20"></Grid>
                <Label Content="{Binding TexturepackName}"
                       Style="{StaticResource ResourceKey=PTSansBold}"
                       Foreground="#FFF"
                       FontSize="20px"
                       VerticalContentAlignment="Center"></Label>
              </StackPanel>
            </Grid>
          </ControlTemplate>
        </Setter.Value>
      </Setter>
      <Style.Triggers>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="IsSelected"
                       Value="true" />
            <Condition Property="Selector.IsSelectionActive"
                       Value="true" />
          </MultiTrigger.Conditions>
          <Setter Property="Template"
                  Value="{DynamicResource SelectedTemplate}" />
        </MultiTrigger>
      </Style.Triggers>
    </Style>
  </ListView.ItemContainerStyle>
</ListView>

当我点击ListViewItem时,它应该在自身上添加背景阴影效果。但是,它会在几分钟内添加此效果,然后将其关闭并切换到默认样式。我怎样才能做到我描述的在ListViewItem的选择上添加背景阴影效果?

哦,天哪,那是凌晨3点,我在应用程序逻辑上犯了一个愚蠢的错误。所以,问题解决了,下面的XAML工作了

您的目标是.Net的哪个版本?BitmapEffects已被弃用,因为它们存在性能问题。你不应该用它们,我用的是.NET3.5。您建议我使用什么来代替BitmapEffect?