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

How to remove the "-" in the header?

2 Answers 59 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Surendra
Top achievements
Rank 1
Surendra asked on 29 Dec 2011, 05:02 PM
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 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 30 Dec 2011, 03:27 PM
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 >>

0
Surendra
Top achievements
Rank 1
answered on 02 Jan 2012, 09:52 AM
Hi Yana,

Thank you so much.

Regards
N.Surendra Prasad
Tags
DatePicker
Asked by
Surendra
Top achievements
Rank 1
Answers by
Yana
Telerik team
Surendra
Top achievements
Rank 1
Share this question
or