Search code examples
xamlwinui-3winui

ItemsView: How to disable each item's hover effect?


I have implemented a ItemsView according to the descriptions in the WinUI 3 Gallery app.

How do I disable the hover effect that occurs when mouse over each item (item becomes darker)?

Thanks


Solution

  • ItemsView uses ItemContainer for each item. Overriding ItemContainerPointerOverBackground should work:

    <ItemsView ItemsSource="{x:Bind Items}">
        <ItemsView.Resources>
            <SolidColorBrush
                x:Key="ItemContainerPointerOverBackground"
                Color="Transparent" />
        </ItemsView.Resources>
    </ItemsView>
    

    You can learn more about it in the generic.xaml.