Change Style of Time Button in RadDateTimePicker

1 Answer 28 Views
DateTimePicker
JIJIKO
Top achievements
Rank 1
Iron
JIJIKO asked on 08 Oct 2021, 01:52 AM

Hi, 

I want to change the Time Button Style of RadDateTimePicker, like mouseover or pressed style.

But i cannot find it in tempalte.

1 Answer, 1 is accepted

Sort by
0
Masha
Telerik team
answered on 12 Oct 2021, 08:56 AM

Hi JIJIKO,

In order to achieve the desired approach, you need to modify the RadClockItemStyle. Please check the code snippet below:

<Style TargetType="telerik:RadClockItem">
	<Setter Property="HorizontalContentAlignment" Value="Center"/>
	<Setter Property="VerticalContentAlignment" Value="Center"/>
	<Setter Property="Padding" Value="5 3"/>
	<Setter Property="SnapsToDevicePixels" Value="True"/>
	<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
	<Setter Property="BorderBrush" Value="{x:Null}"/>
	<Setter Property="BorderThickness" Value="1"/>
	<Setter Property="Background" Value="Transparent"/>
	<Setter Property="Template">
		<Setter.Value>
			<ControlTemplate TargetType="telerik:RadClockItem">
				<Grid x:Name="LayoutRoot" Background="Transparent">
					<Border x:Name="BorderVisual" 
							CornerRadius="1"
							Margin="1"
							Background="{TemplateBinding Background}"
							BorderBrush="{TemplateBinding BorderBrush}"/>
					<ContentPresenter x:Name="Content"
								HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
								VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
								Margin="{TemplateBinding Padding}"/>
				</Grid> 
				<ControlTemplate.Triggers>
					<Trigger Property="IsEnabled" Value="False">
						<Setter TargetName="Content" Property="Opacity" Value="0.5"/>
					</Trigger>
					<Trigger Property="IsMouseOver" Value="True">
						<Setter TargetName="BorderVisual" Property="Background" Value="LightGreen"/>
						<Setter TargetName="BorderVisual" Property="BorderBrush" Value="LightGreen"/>
					</Trigger>
					<Trigger Property="IsSelected" Value="True">
						<Setter TargetName="BorderVisual" Property="Background" Value="LightBlue"/>
						<Setter TargetName="BorderVisual" Property="BorderBrush" Value="LightBlue"/>
					</Trigger>
					<Trigger Property="IsKeyboardFocusWithin" Value="True"/>
				</ControlTemplate.Triggers>
			</ControlTemplate>
		</Setter.Value>
	</Setter>
</Style>

I hope this helps.

Regards,
Masha
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.

JIJIKO
Top achievements
Rank 1
Iron
commented on 13 Oct 2021, 01:26 AM

Thank U, Masha. It works, U R GREAT!!!!!!!!!!!
Tags
DateTimePicker
Asked by
JIJIKO
Top achievements
Rank 1
Iron
Answers by
Masha
Telerik team
Share this question
or