RadSchduleView - TimeRulerItem

1 Answer 43 Views
ScheduleView
Ohad
Top achievements
Rank 2
Iron
Iron
Iron
Ohad asked on 26 Dec 2021, 08:22 AM

Hi,

I want to change the color of the hours,

I tried to change the Foreground in TimeRulerItem but it does not change my color.

I would love to help,

Thanks.

 

 

 

   <Style TargetType="telerik:TimeRulerItem">
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="BorderBrush" Value="White"/>
        <Setter Property="BorderThickness" Value="0 1 0 0"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="Panel.ZIndex" Value="50"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:TimeRulerItem">
                    <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
                        <ContentPresenter Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 27 Dec 2021, 10:00 AM

Hello Ohad,

To achieve the wanted result, you could define a new DataTemplate template with a TextBlock element inside. On the TextBlock control set its Foreground property to the desired color, and then apply it to the TimeRulerItemTemplate property of the RadScheduleView control. You could find additional information on how to template the TimeRulerItem element in this article from our documentation.

The following code snippet shows this approach's implementation:

<Grid>
    <Grid.Resources>
        <DataTemplate x:Key="TimeRulerItemForegroundTemplate">
            <TextBlock Text="{Binding FormattedValue}" Foreground="Red"/>
        </DataTemplate>
    </Grid.Resources>
    <telerik:RadScheduleView TimeRulerItemTemplate="{StaticResource TimeRulerItemForegroundTemplate}" />
</Grid>

With that said, I have attached a sample project for you to test, so, could you give it a try?

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Ohad
Top achievements
Rank 2
Iron
Iron
Iron
commented on 28 Dec 2021, 09:30 AM

It works for me, thank you very much!
Tags
ScheduleView
Asked by
Ohad
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or