Net maui windows platform how to change checkbox tick color or disable tick ?

Sami 856 Reputation points
2024-03-01T23:02:04.8+00:00

Net maui windows platform how to change checkbox tick color or disable tick ? thanks

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

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 34,841 Reputation points Microsoft Vendor
    2024-03-04T05:34:26.7366667+00:00

    Hello,

    For this requirement, you need to override the default style of CheckBox in WinUI3.

    Step 1. Add the following code into Platforms/Windows/App.xaml. Since the default style of CheckBox is too long to post to Q&A, you can refer to the first step in Can we able to modify the design of toggle switch in maui.

    Step 2. You' need to find the <VisualState> tags for CheckedPressed and CheckedPointerOver, then, search the following code:

    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="Foreground">
                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="#00FF00" />
                                                    </ObjectAnimationUsingKeyFrames>
    

    Step 3. Modify the Value of the value in both tags to the RGP value to customize the color of the tick.

    Best Regards,

    Alec Liu.


    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