문제

<ListView ScrollViewer.VerticalScrollBarVisibility="Disabled" Grid.Column="1" Grid.Row="3" ItemsSource="{Binding TeamTagsLiveDTO}" x:Name="teamTagsGrid" HorizontalAlignment="Left" SelectionChanged="SortByPlayerTags" Style="{StaticResource TeamTagsListViewStyle}">
  <ListView.ItemContainerStyle>
    <Style TargetType="{x:Type ListViewItem}">
      <Setter Property="BorderThickness" Value="0"/>
      <Setter Property="Padding" Value="0"/>
      <Setter Property="BorderBrush" Value="{x:Null}"/>
      <Style.Triggers>
        <Trigger Property="IsSelected" Value="true">
          <Setter Property="BorderThickness" Value="0"/>
          <Setter Property="Background" Value="Black"/>
        </Trigger>
        <Trigger Property="IsMouseOver" Value="true">
          <Setter Property="BorderThickness" Value="0"/>
          <Setter Property="BorderBrush" Value="{x:Null}"/>
        </Trigger>
      </Style.Triggers>
    </Style>
  </ListView.ItemContainerStyle>
  <ListView.ItemsPanel>
    <ItemsPanelTemplate>
      <StackPanel Orientation="Horizontal"/>
    </ItemsPanelTemplate>
  </ListView.ItemsPanel>
  <ListView.ItemTemplate>
    <DataTemplate>
      <TextBlock Style="{StaticResource teamtagsstyleLive}" Text="{Binding TeamTagsName1}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
    </DataTemplate>
  </ListView.ItemTemplate>
</ListView>

i have this piece code as shown above:

The setter elements are working fine but the triggers are not working. Whats wrong here?

도움이 되었습니까?

해결책

Solved it. Turns out Control Template handles the background property and the highlght color of the ListViewItem and not the ListViewItem itself.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top