This is a migrated thread and some comments may be shown as answers.

Change display date in TimeLineView

3 Answers 196 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
ttwait
Top achievements
Rank 1
ttwait asked on 05 Dec 2010, 08:17 PM
Looking for an example or insight on how to change the way a date is displayed in ScheduleView with the TimeLine View.

My view will be displaying a month at a time. So I do not need the Time to display and only need the numeric day to display.

I tried to pull it out in Expression Blend, but did not see a Template or Style that relates to the date header. Or is it called something else?

Any help would be great.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 07 Dec 2010, 03:44 PM
Hi Tom,

Thank you for your interest in RadScheduleView.

The quickest way to accomplish this consists roughly of three steps:

1) Verify that you have the DateGroupDescription:
<telerik:RadScheduleView.GroupDescriptionsSource>
                <telerik:GroupDescriptionCollection>
                    <telerik:DateGroupDescription />                    
                </telerik:GroupDescriptionCollection>
</telerik:RadScheduleView.GroupDescriptionsSource>


2) Set the MinorTickLength and MajorTickLength to one day:
<telerik:TimelineViewDefinition MinorTickLength="1day" MajorTickLength="1day" />

3) Modify the OrientedTimeRulerItemStyleSelector - MajorHorizontalTickStyle and MinorHoriozntalTickStyle
Generate the OrientedTimeRulerItemStyleSelector from Expression Blend (Properties tab -> TimeRulerItemStyleSelector -> Convert to New Resource). Modify both the MajorHorizontalTickStyle and MinorHorizontalTickStyle to read the following:

<telerik:OrientedTimeRulerItemStyleSelector.MajorHorizontalTickStyle>
                <Style TargetType="{x:Type telerik:TimeRulerItem}">
                    <Setter Property="Width" Value="0"/>
                    <Setter Property="Height" Value="0" />
                </Style>
    </telerik:OrientedTimeRulerItemStyleSelector.MajorHorizontalTickStyle>

<telerik:OrientedTimeRulerItemStyleSelector.MinorHoriozntalTickStyle>
                <Style TargetType="{x:Type telerik:TimeRulerItem}">
                    <Setter Property="Width" Value="0"/>
                    <Setter Property="Height" Value="0" />
                </Style>
</telerik:OrientedTimeRulerItemStyleSelector.MinorHoriozntalTickStyle>

This will hide the hours from the view and will leave out only the date. I hope this is what you are looking for. If you need further assistance, please let me know.

Kind regards,
Dani
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
ttwait
Top achievements
Rank 1
answered on 08 Dec 2010, 05:28 AM
Great start. Thanks. That gets rid of the time part.

How about formatting the date string? Is it easier then the removal of the time?
0
Dani
Telerik team
answered on 08 Dec 2010, 11:18 AM
Hello Tom,

For the string formatting of the date, it is indeed much easier - you already have what you need. You should use the TimeRuleritemStyleSelector again.

Inside the selector, modify the telerik:OrientedTimeRulerItemStyleSelector.HorizontalGroupItemStyle. Find the following setter and change the StringFormat of the TextBlock to your own liking:

<Setter Property="ContentTemplate">
      <Setter.Value>
        <DataTemplate>
            <TextBlock Margin="6,3" Text="{Binding DateTime, StringFormat=dd-MM-yyyy}"/>
        </DataTemplate>
     </Setter.Value>
</Setter>


Kind regards,
Dani
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
Tags
ScheduleView
Asked by
ttwait
Top achievements
Rank 1
Answers by
Dani
Telerik team
ttwait
Top achievements
Rank 1
Share this question
or