In UWP I have a listview.
XAML:
<Grid Background="Gray">
<ListView Name="lvMain" VerticalAlignment="Top" HorizontalAlignment="Stretch" Height="120" ItemsSource="{x:Bind ItemsList, Mode=OneWay}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate x:DataType="x:Int32">
<Grid Width="100" Height="100" Padding="10">
<Grid Background="Green"/>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
And in Code behind:
using System.Collections.ObjectModel;
using Windows.UI.Xaml.Controls;
public sealed partial class MainPage : Page
{
public ObservableCollection<int> ItemsList { get; set; } = new ObservableCollection<int>();
public MainPage()
{
InitializeComponent();
for (int i = 0; i < 10; i++)
{
ItemsList.Add(i);
}
}
}
And the results are as bellow:
How to remove all the effects/lights on mouse hover from listview?
The highlighting color you see when you hovering mouse over an item is defined in the default style and template for ListViewItem.
Specifically, search for this line in the default style
You can create a special style for
ListViewItem
and set this color toTransparent
, and apply the special style to yourListView
.This page provides the guide to work with styles.
Edit: I just found this post asking similar question, the accepted answer shows how to edit the template in Visual studio.
Add to @kennyzx's reply. The lines you're talking about actually is Reveal Highlight. You could see the default style of ListViewItem in the
\(Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\your sdk version\Generic\generic.xaml
.You could see it uses many 'Reveal' Theme Resources. All these resources name contain the word 'Reveal'. For example,
RevealBackground="{ThemeResource ListViewItemRevealBackground}"
.If you do not want it, you could replace them all.