Hey Guys,
Can you give me a hand and tell me how to change Background Color of TextBox of disabled DatePicker? I attached the screenshot.
Regards,
Tom
Can you give me a hand and tell me how to change Background Color of TextBox of disabled DatePicker? I attached the screenshot.
Regards,
Tom
3 Answers, 1 is accepted
0
Hi Tom,
You can change the Background color of RadWatermarkTextBox in a disabled RadDateTimePicker by
creating an implicit style for RadWatermarkTextBox. There you can find the disable state visual, which you need to customize.
Inside the control template of RadWatermarkTextBox, find the following:
Changing the Background of this border, will change the Background of RadWatermarkTextBox when disabled.
I hope this will be helpful.
Regards,
Maria
the Telerik team
You can change the Background color of RadWatermarkTextBox in a disabled RadDateTimePicker by
creating an implicit style for RadWatermarkTextBox. There you can find the disable state visual, which you need to customize.
Inside the control template of RadWatermarkTextBox, find the following:
<
Border
x:Name
=
"DisabledVisualElement"
BorderBrush
=
"#FF989898"
BorderThickness
=
"{TemplateBinding BorderThickness}"
Background
=
"#FFE0E0E0"
CornerRadius
=
"1"
IsHitTestVisible
=
"False"
Opacity
=
"0"
/>
Changing the Background of this border, will change the Background of RadWatermarkTextBox when disabled.
I hope this will be helpful.
Regards,
Maria
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Tom
Top achievements
Rank 1
answered on 03 Jul 2012, 10:53 AM
Hi,
Thanks for the reply. I'm much closer, but not there yet. Can you provide me with more extended example? I did this:
Thanks for the reply. I'm much closer, but not there yet. Can you provide me with more extended example? I did this:
<
Style
TargetType
=
"telerik2:RadWatermarkTextBox"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik2:RadWatermarkTextBox"
>
<
Border
x:Name
=
"DisabledVisualElement"
BorderBrush
=
"#FF989898"
BorderThickness
=
"{TemplateBinding BorderThickness}"
Background
=
"#FFE0E0E0"
CornerRadius
=
"1"
IsHitTestVisible
=
"False"
Opacity
=
"0"
>
<
TextBlock
Text
=
"{Binding Path=SelectedDate, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadDatePicker}}}"
/>
</
Border
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
But that solution overrides DisplayFormat.
Is there a way to change only Background without interfering with the rest of ControlTemplate?
If not, can you provide me with the original ControlTemplate so I could just change things I nedd to change and leave the rest?
Regards,
Tom
0
Tom
Top achievements
Rank 1
answered on 03 Jul 2012, 01:54 PM
Allright,
So I did this:
<
Style
TargetType
=
"telerik:RadDatePicker"
>
<
Setter
Property
=
"Background"
Value
=
"Green"
/>
</
Style
>
<
Style
TargetType
=
"telerik2:RadWatermarkTextBox"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik2:RadWatermarkTextBox"
>
<
ContentPresenter
Content
=
"{Binding Path=CurrentDateTimeText, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadDatePicker}}}" /
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
And it worked for me (except some styling which has to be done additionally).
Case closed.
Regards,
Tomasz