Share via

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

dg2k 1,401 Reputation points
Jul 21, 2022, 4:29 PM

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.
4,062 questions
0 comments No comments
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 36,416 Reputation points Microsoft External Staff
    Jul 22, 2022, 8:54 AM

    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.