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

Week number in MonthView

5 Answers 112 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Håkan
Top achievements
Rank 1
Håkan asked on 22 Aug 2011, 03:21 PM
Hi,

I think I read somewhere that in the new Q2 release, it was possible to display the week number, but I can't get it to work.
I would like to show the week number instead of the default date range that is displayed in the left group header in MonthView.
Is it possible?

Regards,
Håkan

5 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 24 Aug 2011, 02:47 PM
Hi Håkan,

In order to display the week numbers, you will have to set the ShowWeekGroupHeaders property of the WeekDefinition to True, for example:

<telerik:RadScheduleView>            
         <telerik:RadScheduleView.ViewDefinitions>
               <telerik:DayViewDefinition EnableSmallAppointmentRendering="True"
                    Orientation="Vertical"  />
               <telerik:WeekViewDefinition 
                   ShowWeekGroupHeaders="True" 
                   WeekGroupHeaderStringFormat="Week number {0}, {1:D}" />
         </telerik:RadScheduleView.ViewDefinitions>
</telerik:RadScheduleView>

As for month view, you will have to edit the template of the ScheduleView. I happened to have an example from Q1 2011 with this implemented in each view. However, you might need to update the template with the one from Q2 2011 version and apply the changes only to month view.

Hope this helps.

Best wishes,
Konstantina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Håkan
Top achievements
Rank 1
answered on 25 Aug 2011, 08:30 AM
Works fine, thanks!

But what about the TimelineView?
I currently use this format for the TimelineViewDefinition:
TimerulerGroupStringFormat="{}{0:dddd %d MMMM}"

But I also want to include the week number since the user can show up to a month in this view in out application.

Regards,
Håkan

0
Konstantina
Telerik team
answered on 01 Sep 2011, 06:40 AM
Hello Håkan,

In order to use this format, you need to set the StringFormat value of the TextBlock in the VerticalWeekNumberTemplate on the MainPage:

<local:HeaderSelector.VerticalWeekNumberTemplate>
                <DataTemplate>
                    <telerikPrimitives:LayoutTransformControl VerticalAlignment="Top">
                        <telerikPrimitives:LayoutTransformControl.LayoutTransform>
                            <RotateTransform Angle="-90" />
                        </telerikPrimitives:LayoutTransformControl.LayoutTransform>
                        <StackPanel Orientation="Horizontal" Margin="4 1" Height="16">
                            <TextBlock Text="{Binding FormattedName, StringFormat='{}{0:dddd %d MMMM}'}"/>
                            <TextBlock Text=", Week " />
                            <TextBlock Text="{Binding Name, Converter={StaticResource DateTimeToWeekNumber}}" />
                        </StackPanel>
                    </telerikPrimitives:LayoutTransformControl>
                </DataTemplate>
            </local:HeaderSelector.VerticalWeekNumberTemplate>


Kind regards,
Konstantina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Håkan
Top achievements
Rank 1
answered on 20 Sep 2011, 09:40 AM
Hi Konstantina,

Where can I find this HeaderSelector.VerticalWeekNumberTemplate?

It does not exist in my template, found in either ScheduleView.xaml or when creating the template from Blend.

Where exactly do I put it?

I use resource grouping in my TimelineView, so my template looks lite this:

<local:CustomOrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate>
    <DataTemplate>
        <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Width="150">
            <StackPanel.Resources>
                <Style TargetType="TextBlock" BasedOn="{StaticResource DefaultTextBlock}">
                    <Setter Property="VerticalAlignment" Value="Center" />
                    <Setter Property="TextWrapping" Value="NoWrap" />
                </Style>
            </StackPanel.Resources>
            <TextBlock Text="{Binding Name}" HorizontalAlignment="Center" Padding="5,3,5,0" />
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="5,0,5,3">
                <TextBlock Text="{Binding Name.PlannedMinutes, Converter={StaticResource MinutesToTimeSpanConverter}}" />
                <TextBlock Text="/" />
                <TextBlock Text="{Binding Name.WorkingHoursMinutes, Converter={StaticResource MinutesToTimeSpanConverter}}" />
            </StackPanel>
        </StackPanel>
    </DataTemplate>
</local:CustomOrientedGroupHeaderContentTemplateSelector.VerticalResourceTemplate>

I have also extended the Resource class and added some properties, for example PlannedMinutes and WorkingHoursMinutes as you can see.

Regards,
Håkan
0
Konstantina
Telerik team
answered on 22 Sep 2011, 04:50 PM
Hi Håkan,

This HeaderSelector is the defined additionally class for managing the headers. You need to replace only the style in the "themes" folder with the up to date one in order to do further customizations. Please refer to the attached project in the previous post, in it this is illustrated.

Hope this information helps.

Best wishes,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
ScheduleView
Asked by
Håkan
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Håkan
Top achievements
Rank 1
Share this question
or