Cannot Change Text Color for Disabled State of CheckBox

Hello, I am trying to change the text color for disabled checkboxes, but it is not working. I am attempting to do this in the same manner as Xamarin controls like buttons, where I change setters in XAML based on their visual state in their state manager. 

For example:


            <Style TargetType="button:SfCheckBox">

                <Setter Property="CheckedColor" Value="Red"/>

                <Setter Property="TickColor" Value="Blue"/>

                <Setter Property="UncheckedColor" Value="Green"/>

                <Setter Property="VisualStateManager.VisualStateGroups">

                    <VisualStateGroupList>

                        <VisualStateGroup x:Name="CommonStates">

                            <VisualState x:Name="Disabled">

                                <VisualState.Setters>

                                    <Setter Property="TextColor" Value="Orange"/>

                                </VisualState.Setters>

                            </VisualState>

                        </VisualStateGroup>

                    </VisualStateGroupList>

                </Setter>

            </Style>


The first three colors are correct, but the text color when the button is disabled is not appearing as orange, it is just grey. What do I have to do in order to change the color of a disabled checkbox? Thank you.





4 Replies

FR Frank August 14, 2022 01:42 PM UTC

I would like to add that I have tried Style Triggers to see if that would work, but it only works for properties that aren't TextColor. It can change background color, but it won't change text color. The below code also does not work.


            <Style TargetType="button:SfCheckBox">

                <Setter Property="CheckedColor" Value="Red"/>

                <Setter Property="TickColor" Value="Blue"/>

                <Setter Property="UncheckedColor" Value="Green"/>

                <Style.Triggers>

                    <Trigger TargetType="button:SfCheckBox" Property="IsEnabled" Value="False">

                        <Setter Property="TextColor" Value="Orange"/>

                    </Trigger>

                </Style.Triggers>

                </Setter>

            </Style>





VV Vijayakumar Viswanathan Syncfusion Team August 15, 2022 12:26 PM UTC

Hi Frank,


Currently, we are validating the reported issue on our side. We will let you know the details on 17th August 2022.



Regards,

Vijayakumar V



FR Frank September 14, 2022 06:43 PM UTC

Has this been validated? Thanks.



RS Ruba Shanmugam Syncfusion Team September 16, 2022 11:04 AM UTC

Hi Frank,


Query: Cannot Change Text Color for Disabled State of CheckBox


Sorry for the late response. We have checked the reported issue and we could able to replicate the same on our side, After further investigation, the Gray color setting for text color in the disabled state is the current behaviour of SfCheckBox. We have tried to achieve your requirement to apply text color in the disabled state with a workaround. But, we are facing more complexities to achieve this with the current implementation. We really regret to say that there are no possibilities to achieve this requirement.

Please let us know if you need any further assistance.

Regards,

Ruba Shanmugam


Loader.
Up arrow icon