Custom navigation header on scheduleview - hide view button, add custom button, alter date format

4 posts, 0 answers
  1. Rick Tett
    Rick Tett avatar
    3 posts
    Member since:
    Jun 2008

    Posted 24 Oct 2011 Link to this post

    I may be missing it, but I am not finding a way to alter the top navigation bar on the scheduleview either in the documentation or the forum.  I am using the Timeline view only and I want to do three things:
    a) hide the Timeline view button
    b) change the format of the date range to "MM/YY" instead of "DD MM YYYY"
    c) add custom buttons on it

    See the attached image showing my bar and desired changes...

  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 25 Oct 2011 Link to this post

    Hi Rick,

    Normally, you would need to change the template of RadScheduleView control - to remove the ListBox which holds the ViewDefinitions as its Items and to insert your own visual elements. This would require that you include in your project a lot of xaml mark-up.

    So I would suggest that you use the approach demonstrated in the online FirstLook example of RadScheduleView. You can hide the navigation header via NavigationHeaderVisibility="Collapsed" and place your own visual elements.

    For changing the formatting of the visible range text, however, you do need to edit the RadScheduleView template. Contained in the NavigationHeader Border, you will find the following ContentControl:
    <ContentControl x:Name="CurrentInterval" Content="{TemplateBinding CurrentVisibleRangeText}" 
                                                        HorizontalAlignment="Right" 
                                                        Style="{StaticResource NavigationIntervalStyle}" 
                                                        VerticalAlignment="Center"/>

    If you bind to VisibleRange instead of CurrentVisibleRangeText, and provide a custom style that contains string formatted TextBlocks:

    <Style x:Key="NavigationIntervalStyle2" TargetType="ContentControl">
                <Setter Property="Margin" Value="5"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="HorizontalAlignment" Value="Right"/>
                <Setter Property="FontWeight" Value="Bold"/>
                <Setter Property="ContentTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock Foreground="{StaticResource NavigationIntervalForegroundFront}" Text="{Binding Start, StringFormat=dd/MM}"/>
                                <TextBlock Text="-" Foreground="{StaticResource NavigationIntervalForegroundFront}" />
                                <TextBlock Foreground="{StaticResource NavigationIntervalForegroundFront}" Text="{Binding End, StringFormat=dd/MM}"/>
                            </StackPanel>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

    you will be able to change the formatting of the visible range text.

    I hope this will help in customizing your instance of RadScheduleView.


    Kind regards,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. DevCraft banner
  4. Kjell
    Kjell avatar
    276 posts
    Member since:
    Jun 2010

    Posted 25 Nov 2011 Link to this post

    Is there a way to do this at the view definition level?  I want to change the format on the week view but don't want it to impact the month view.
  5. Dani
    Admin
    Dani avatar
    848 posts

    Posted 28 Nov 2011 Link to this post

    Hi Kjell,

    If you want to change the formatting depending on the view definition, basically what you can do is, taking into account the suggested approach from my previous post,  have two ContentControls and bind their Visibility to the ActiveViewDefinition via a Converter. This way you will be able to provide differently formatted values for WeekView and MonthView.

    I hope this helps.

    All the best,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top