6 Answers, 1 is accepted
I've prepared a small sample project where defining the following style correctly updates the background of the RadNumericUpDown when it is in the read-only state:
<
Style
BasedOn
=
"{StaticResource RadNumericUpDownStyle}"
TargetType
=
"telerik:RadNumericUpDown"
>
<
Style.Triggers
>
<
Trigger
Property
=
"IsReadOnly"
Value
=
"True"
>
<
Setter
Property
=
"Background"
Value
=
"LightGray"
/>
</
Trigger
>
</
Style.Triggers
>
</
Style
>
Please note that if you're using the StyleManager approach for styling the controls with the Xaml assemblies, you should omit the BasedOn attribute of the style.
Could you please also test this at your end and let me know if such an approach would work for you? I look forward to your reply.
Regards,
Dilyan Traykov
Progress Telerik

Hi Dilyan,
Thank you for your reply. I don't know why, but the style is not applied at runtime. Here's my control:
<
telerik:RadNumericUpDown
Grid.Row
=
"10"
Grid.Column
=
"1"
Value
=
"{Binding SelectedCustomerCreditControl.TotalOutstandingAmount, Mode=OneWay}"
IsReadOnly
=
"True"
ShowButtons
=
"False"
ValueFormat
=
"Numeric"
NumberDecimalDigits
=
"2"
NumberDecimalSeparator
=
"."
>
<
telerik:RadNumericUpDown.Style
>
<
Style
TargetType
=
"{x:Type telerik:RadNumericUpDown}"
>
<
Style.Triggers
>
<
Trigger
Property
=
"IsReadOnly"
Value
=
"True"
>
<
Setter
Property
=
"Background"
Value
=
"DodgerBlue"
/>
</
Trigger
>
</
Style.Triggers
>
</
Style
>
</
telerik:RadNumericUpDown.Style
>
</
telerik:RadNumericUpDown
>
In desing mode the control has the right color, but at run time, it seems like the style is overwritten and the control has the default background color.
Applying the same style to a simple TextBox works fine, so the problem is realy related to the RadNumericUpDown control.
Any ideas ?
Regards,
Hans
My name is Dinko and I'm stepping in for my colleague Dilyan, who is currently out of the office.
I have double checked the example provided by my colleague Dilyan and it is working as expected on my side. The style is applied runtime and design time. It is strange that the Style is not applied on your side. May I ask you some more details about your project set up.
- What version of our controls are you using?
- Can you run the project provided by Dilyan and let me know without doing any modifications if the style is applied correctly?
- I am assuming that the provided code snippet is from your application. Can you double check if they are other styles which target the RadNumericUpDown control?
- Can you try to isolate this behavior is a stand-alone project?
I am looking forward to your reply.
Regards,
Dinko
Progress Telerik

Hello Dinko,
the problem is due to the Office2016 theme that is set in the App.xaml.cs
Telerik.Windows.Controls.StyleManager.ApplicationTheme = new Telerik.Windows.Controls.Office2016Theme();
When I put this line in comment, the style is applied.
Obiously, I would like to keep the Office2016 style AND have the ReadOnly style applied to my RadNumericUpDown control.
Regards,
Hans

Hi,
I solved the problem by using implicit styles instead of the StyleManager.
Regards,
Hans
I am happy to hear that you found a solution for your case. If you have any other questions you can open a new thread with your questions inside.
Regards,
Dinko
Progress Telerik