How to remove the "-" in the header?

3 posts, 0 answers
  1. Surendra
    Surendra avatar
    9 posts
    Member since:
    Apr 2011

    Posted 29 Dec 2011 Link to this post

    Hi,
    I have a requirement to display the header of the datetimepicker as "December 2011" instead of "December - 2011".

    I went through the style of  CalendarHeaderButton, in which i found the below 2 lines of code which is used to display the header in the control,

     

    <

     

     

    TextBlock x:Name="BackgroundText" Foreground="{StaticResource HeaderTextBackground}" FontWeight="{StaticResource HeaderTextFontWeight}" HorizontalAlignment="Center" Margin="0 2 0 0" Text="{TemplateBinding Content}" VerticalAlignment="Center"/>

     

     

     

     

     

     

     

     

    <TextBlock x:Name="ForegroundText" Foreground="{StaticResource HeaderTextForeground}" FontWeight="{StaticResource HeaderTextFontWeight}" HorizontalAlignment="Center" Margin="0 1 0 1" Text="{TemplateBinding Content}" VerticalAlignment="Center"/>

     

     

     

     

    Since TemplateBinding is used here, i am not able to use a Converter to achieve this. Is there any alternate way to do this?

    Regards
    N.Surendra Prasad

  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 30 Dec 2011 Link to this post

    Hello Surendra,

    You just need to set MonthViewHeaderFormat property of the Calender in DateTimePicker like this:

    <telerik:RadDateTimePicker InputMode="DateTimePicker">
        <telerik:RadDateTimePicker.CalendarStyle>
            <Style TargetType="telerik:RadCalendar">
                <Setter Property="MonthViewHeaderFormat" Value="MMMM yyyy" />
            </Style>
        </telerik:RadDateTimePicker.CalendarStyle>
    </telerik:RadDateTimePicker>

    You don't need to edit the template.  Here you can find all the custom format strings that can be used.

    Kind regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Surendra
    Surendra avatar
    9 posts
    Member since:
    Apr 2011

    Posted 02 Jan 2012 Link to this post

    Hi Yana,

    Thank you so much.

    Regards
    N.Surendra Prasad
Back to Top