Week number in MonthView

6 posts, 0 answers
  1. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 22 Aug 2011 Link to this post

    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
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 24 Aug 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 25 Aug 2011 Link to this post

    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

  5. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 01 Sep 2011 Link to this post

    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 >>

  6. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 20 Sep 2011 Link to this post

    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
  7. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 22 Sep 2011 Link to this post

    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 >>
Back to Top
DevCraft banner