Style for disabled RadEntry is not working

1 Answer 183 Views
Entry General Discussions
Nelson
Top achievements
Rank 1
Nelson asked on 16 Aug 2023, 03:18 AM | edited on 16 Aug 2023, 03:19 AM

Hi, 

I'm trying to apply style for a disabled RadEntry in my current project but it is not working. Tried both styling from VisualStateManager and Style.Triggers but not working. Also strange that when I use the style from IsEnabled = true, the style is now working. Here's my code from Styles.xaml


<Style TargetType="telerik:RadEntry">
    <Setter Property="FontFamily" Value="OpenSansRegular"/>
    <Setter Property="FontSize" Value="14"/>
    <Setter Property="TextColor" Value="{StaticResource FieldTextColor}" />
    <Setter Property="BorderBrush" Value="{StaticResource FieldBorderBrushColor}"/>
    <Setter Property="BorderThickness" Value="1,1,1,2"/>
    <Setter Property="FocusedBorderBrush" Value="{StaticResource FieldBorderBrushColor}"/>
    <Setter Property="BackgroundColor" Value="{StaticResource FieldBackgroundColor}"/>
    <Setter Property="VisualStateManager.VisualStateGroups">
        <VisualStateGroupList>
            <VisualStateGroup x:Name="CommonStates">
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="Disabled">
                    <VisualState.Setters>
                        <Setter Property="BackgroundColor" Value="{StaticResource FieldInactiveColor}"></Setter>
                        <Setter Property="TextColor" Value="{StaticResource FieldTextInactiveColor}"></Setter>
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateGroupList>
    </Setter>
    <!--<Style.Triggers>
        <Trigger TargetType="telerik:RadEntry" Property="IsEnabled" Value="False">
            <Setter Property="BackgroundColor" Value="{StaticResource FieldInactiveColor}"/>
            <Setter Property="TextColor" Value="{StaticResource FieldTextInactiveColor}"/>
        </Trigger>
    </Style.Triggers>-->
</Style>

 

Screenshot from the app:

Style should be like this

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Maria
Telerik team
answered on 21 Aug 2023, 01:21 PM

Hello Nelson, 

Thank you for the images and the provided code snippet.

I reproduced the undesired behavior. In order to update the disabled background color you have to use the native control template and set the Visual States to the native element. I have attached a project with the approach implemented on WinUI. Check the Platforms/Windows/App.xaml file. 

Regards,
Maria
Progress Telerik

A brand new .NET MAUI course was just added to the Virtual Classroom. The training course is developed to help you get started with the Telerik UI for .NET MAUI components and features. It aims to put you in the shoes of an engineer who adds new features to an existing application. You can check it out at https://learn.telerik.com
Tags
Entry General Discussions
Asked by
Nelson
Top achievements
Rank 1
Answers by
Maria
Telerik team
Share this question
or