Combox theme color

1 Answer 15 Views
ComboBox
Shengyang
Top achievements
Rank 1
Shengyang asked on 20 Feb 2025, 08:30 AM

I have a quite strange behavior for ComboBox

When I set IsReadOnly to true the ReadOnlyBorderBrush of the theme is apllied but ReadOnlyBackBrush is not, also it is not really read only value can still be changed by the user. To avoid this I have set IsReadOnly to true and IsEnabled to false in that case neither Border nor BackBrush is applied.

What am I missing here?

Here is a example 1st Combox has IsReadOnly="True" IsEnabled="False", 2nd Combox only IsReadOnly="True" and at the bottom a TextBox with only IsReadOnly="True" as reference.

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 24 Feb 2025, 03:43 PM

Hello Shengyang,

Based on the shared image, my guess is that the VisualStudio2019 theme is used on your side. Please correct me if I am wrong.

If this is indeed the used theme, when the RadComboBox's IsReadOnly property is set to True, only the BorderBrush will be updated. This is a design decision that was taken when creating this theme.

With this in mind, to change it, you can create a new Style that targets the RadComboBox and set its Background via a Trigger for when the IsReadOnly property is set to True.

The following code snippet shows this suggestion's implementation:

<telerik:RadComboBox IsReadOnly="True">
    <telerik:RadComboBox.Style>
        <Style TargetType="telerik:RadComboBox">
            <Style.Triggers>
                <Trigger Property="IsReadOnly" Value="True">
                    <Setter Property="Background" Value="LightGray"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </telerik:RadComboBox.Style>
</telerik:RadComboBox>

The produced result is as follows where the top one is read-only and disabled and the bottom one is only read-only:

With this being said, I hope this suggestion will be of help to you.

Regards,
Stenly
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!

Tags
ComboBox
Asked by
Shengyang
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or