How do you style the Clear and Close buttons on a RadTimeSpanPicker?

2 Answers 26 Views
Styling
Chuck
Top achievements
Rank 1
Iron
Chuck asked on 09 May 2025, 09:23 PM

I am using the RadTimeSpanPicker to choose a duration, and I'd like to style the Clear and Close buttons to match the Run New Objective button.  How can I access the button styles?

Thanks,

Chuck

2 Answers, 1 is accepted

Sort by
1
Accepted
Stenly
Telerik team
answered on 14 May 2025, 07:47 AM

Hello Chuck,

To achieve this requirement, extract the default ControlTemplate of the RadTimeSpanPicker control and locate the two RadButton instances with x:Name="PART_Clear" and x:Name="PART_Close". After that, it can be applied via an implicit Style to affect all instances or via an explicit one to affect only specific ones.

An important thing here is that these buttons are retrieved internally, so they should not be removed. Generally, this is the case when elements inside our default ControlTemplates contain the "PART_" prefix. 

Optionally, you could extract the default ControlTemplate of the RadButton element and customize it, in order to have more control over the customization to achieve the result from the shared image.

With this being said, I hope the provided information will be of help to you.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Chuck
Top achievements
Rank 1
Iron
commented on 15 May 2025, 06:12 PM

Thanks, Stenly.  I extracted the RadButton template and put it in the Resources section of my control, but the buttons in the RadTimeSpanPicker didn't change.  Here is what I'm using:   

        <Style x:Key="RadButtonStyle" TargetType="telerik:RadButton">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Background" Value="{StaticResource SymboticDarkGreen}"/>
            <Setter Property="BorderBrush" Value="{StaticResource SymboticDarkGreen}"/>
            <Setter Property="CornerRadius" Value="5"/>
            <Setter Property="Padding" Value="4"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
        </Style>
Can you please tell me what I'm doing wrong?
Chuck
Top achievements
Rank 1
Iron
commented on 16 May 2025, 11:59 AM | edited

.
Stenly
Telerik team
commented on 20 May 2025, 12:43 PM

Hello Chuck,

I attached a sample project, which showcases the suggestion mentioned in the above answer, as well as using the Style that you provided.

The application produces the following result:

Could you give it a try and let me know how it goes?

Chuck
Top achievements
Rank 1
Iron
commented on 22 May 2025, 08:35 PM

I do have a question, though.  When I choose a non-zero seconds value and then hit the Clear button, the textbox is empty and shows the watermark text, but when I query the control, it still has the old seconds value it had before I hit clear.  Is this expected?
Stenly
Telerik team
commented on 23 May 2025, 04:02 PM

Hello Chuck, 

I am not sure that I fully understand this. Would it be possible to share a bit more information regarding it? The attached sample project in the above answer could also be used to showcase this behavior.

Chuck
Top achievements
Rank 1
Iron
commented on 23 May 2025, 05:10 PM

It is working in your project.  Sounds like a me problem.  Thanks again for your help.
0
Chuck
Top achievements
Rank 1
Iron
answered on 22 May 2025, 08:10 PM
Thank you, that worked perfectly.
Chuck
Top achievements
Rank 1
Iron
commented on 22 May 2025, 08:34 PM | edited

.
Tags
Styling
Asked by
Chuck
Top achievements
Rank 1
Iron
Answers by
Stenly
Telerik team
Chuck
Top achievements
Rank 1
Iron
Share this question
or