Can Item Selection Checkbox for CollectionView be revealed by applying XAML Style on WinUI?

dg2k 1,386 Reputation points
2022-07-21T16:29:08.697+00:00

The item selection checkboxes for CollectionView are not visible as they should on WinUI (see screenshot below).

I noticed a similar visibility issue for the navigation BackButton which I got solved through XAML styling, thanks to @Rob Caplan - MSFT .

Although the checkboxes are not clearly visible, the selected/unselected logic for list items works as expected.

Can the selection checkboxes be revealed by tweaking with XAML Style, and if so how?

223237-collectionview-checkbox.png

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,925 questions
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 26,751 Reputation points Microsoft Vendor
    2022-07-22T08:54:24.89+00:00

    Hello,

    Please check ListViewItemBackgroundSelected, ListViewItemBackgroundPressed, ListViewItemBackgroundSelectedPointerOver and ListViewItemBackgroundSelectedPressed in Windows UI Library, and set other colors. Try to add the following code in App.xaml under Platforms/ Windows :

    <maui:MauiWinUIApplication.Resources>  
      
            <SolidColorBrush x:Key="ListViewItemBackgroundSelected" Color="Red" />  
            <SolidColorBrush x:Key="ListViewItemBackgroundPressed"  Color="Red" />  
            <SolidColorBrush x:Key="ListViewItemBackgroundPointerOver"  Color="Red" />  
            <SolidColorBrush x:Key="ListViewItemBackgroundSelectedPointerOver"  Color="Red" />  
             
        </maui:MauiWinUIApplication.Resources>  
    

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful