Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 989397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:47:09+00:00 2026-05-16T05:47:09+00:00

I have a ListView , with ListView.View as GridView . Default, the mouseOver is

  • 0

I have a ListView, with ListView.View as GridView.

Default, the mouseOver is working, ListViewItem get highlighted when I mouseover, and get selected when I click it. But after I modified the ControlTemplate, I get the template I want, but the highlight and select is gone.

I use trigger, but it’s not working.

Here is my code.

<Style x:Key="filesListViewItemStyle" TargetType="{x:Type ListViewItem}">
            <Setter Property="IsSelected" Value="{Binding FileIsSelected}"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ListViewItem">
                        <Grid Height="40">
                            <GridViewRowPresenter/>
                            <Line X1="0.0" Y1="0.0" X2="{Binding ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListView}}}" Y2="0.0" StrokeThickness="1" StrokeDashArray="2" Stroke="Gray" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="Green"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

In my template, I actually added a line as a separator between 2 rows of ListViewItem.

I just don’t get it why the trigger is not working!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:47:10+00:00Added an answer on May 16, 2026 at 5:47 am

    The Background property of a Control is only used in the ControlTemplate. You have replaced the template with one that does not use Background, so setting the property has no effect. You can use {TemplateBinding Background} to bind properties to the Background of the Control. Perhaps you want to bind the Background of the Grid to it:

    <ControlTemplate TargetType="ListViewItem">
        <Grid Height="40" Background="{TemplateBinding Background}">
            <GridViewRowPresenter/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listview <ListView Name=listView2> <ListView.View> <GridView> <!-- First Column --> <GridViewColumn Width=105
I have a nicely working custom CursorAdapter with customized ListView. This view allows the
I have WPF ListView with GridView view and I want to remove any trace
I have a ListView using a GridView as it's view and each item in
I have the follwoing listview in my xaml: <ListView Name=listView1> <ListView.View> <GridView> <GridViewColumn Width=Auto
I have a WPf ListView that i am replacing the View with GridView to
I have the following GridView : <ListView Name=TrackListView ItemContainerStyle={StaticResource itemstyle}> <ListView.View> <GridView> <GridViewColumn Header=Title
I have a ListView with the following code: <ListView Name=ListView1> <ListView.View> <GridView> <GridViewColumn Header=File
I have the following ListView: <ListView Name=listView> <ListView.View> <GridView> <GridView.ColumnHeaderContainerStyle> <Style TargetType={x:Type GridViewColumnHeader}> <Setter
I have the following ListView : <ListView Name=TrackListView> <ListView.View> <GridView> <GridViewColumn Header=Title Width=100 HeaderTemplate={StaticResource

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.