Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable ListView's Hover and Tile effects?

I want to disable Tile effect that is some kind of pushed effect and hover background color effect of ListView control, how can i do that?

Thanks

like image 990
mehmet6parmak Avatar asked Aug 03 '12 07:08

mehmet6parmak


People also ask

How to disable a CSS hover effect?

- GeeksforGeeks How to disable a CSS :hover effect? The task is to remove the CSS:hover property from the element. Here we are going to use JavaScript to solve the problem. Simply remove the class which is adding the hover effect to the element using JQuery by .removeClass () method. Example 1: This example using the approach discussed above.

How do I disable the effect of a listviewitem in listview?

It's located inside the ControlTemplate of an ListViewItem, which is the ItemContainer for the ListView. The simplest way I've found to disable the effect is to simply override this ControlTemplate:

What is itemmousehover in listview?

List View. Item Mouse Hover Event System. Windows. Forms Occurs when the mouse hovers over an item. The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the ItemMouseHover event. This report helps you to learn when the event occurs and can assist you in debugging.

How do I change the template of a listview?

You can also make changes to the template to remove any visual states and adornments - go to the designer and right click your ListView/Edit Additional Templates/Edit Generated Item Container (ItemContainerStyle)/Edit a Copy... - that will extract the template you can modify using your preferred method.


1 Answers

After some googling I found that the highlighting happens in the ListViewItemPresenter, which turns out to be pretty hidden. It's located inside the ControlTemplate of an ListViewItem, which is the ItemContainer for the ListView. The simplest way I've found to disable the effect is to simply override this ControlTemplate:

<ListView>
<ListView.ItemContainerStyle>
    <Style TargetType="ListViewItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate>
                    <ContentPresenter/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ListView.ItemContainerStyle>
<TextBlock Text="List Item" />
...
<TextBlock Text="List Item" />

source: https://blog.jonstodle.com/uwp-listview-without-highlighting-and-stuff/

like image 118
Hanzalah Adalan Avatar answered Oct 24 '22 14:10

Hanzalah Adalan