简体   繁体   中英

Xamarin.Forms How can I disable hover highlight effect on listview

I am developing a Xamarin.Forms project that uses a Listview.

In this listview, I use a datatemplate to show my own made cards in the listview. The listview with my custom made cards renders correctly, however there is one thing that doesn't go as expected.

In the UWP application, when I hover over an item in the listview, a hover highlight colour appears on my card. I want to disable the hover effect completely for all listviews in the app.

I know this is standard behaviour in a UWP application but I like to disabled it completely.

I already tried to make a control template in App.xaml, but I can't get it working. I already tought to make a custom renderer but I don't know how I can do this.

I also use a custom control (FlowListView by DLToolkit) which also uses a hover effect just like listview.

How can I disable the hover highlight colour effect in a listview/FlowListView using Xamarin.Forms?

I don't know if it works. But have you tried disabling itemSelection:

MyListView.ItemSelected += (sender, e) => {
     ((ListView)sender).SelectedItem = null;
};

I fixed this problem by setting FlowTappedBackgroundColor and FlowRowBackgroundColor to a same colour.

Note that the highlight colour is still there, however you can't notice because the highlight colour is the same as the background colour.

lstFlowList.FlowTappedBackgroundColor = Color.White;
lstFlowList.FlowRowBackgroundColor = Color.White;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM