質問

<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