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

Show only year in ViewHeader

5 Answers 36 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
RR
Top achievements
Rank 1
RR asked on 17 Mar 2015, 05:47 AM

In month view calendar header shows as "March - 2015" ... How to show only  "2015" ?

5 Answers, 1 is accepted

Sort by
0
Geri
Telerik team
answered on 18 Mar 2015, 09:34 AM
Hi Roshan,

Thank you for contacting us.

You can achieve the desired look by modifying the format of the MonthViewHeader property as follows:

<telerik:RadCalendar MonthViewHeaderFormat="yyyy" />

Hope this helps.

Regards,
Geri
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
RR
Top achievements
Rank 1
answered on 19 Mar 2015, 05:37 AM
Thanks Geri.. 

Please refer to the picture attached. there are both calendarHeader and mothsheaders. by adding 
MonthViewHeaderFormat="yyyy

Both calendarHeader and  monthHeaders are changing. But I want to change only the top calendar hear to the 'yyyy' format.  
0
Geri
Telerik team
answered on 19 Mar 2015, 02:03 PM
Hi Roshan,

The desired functionality does not come built-in in the RadCalendar. However, it can be achieved easily by modifying the ControlTemplate of the CalendarHeaderButton. You would need to find the the two TextBlock elements named "BackgroundText" and "ForegroundText" and change the text as needed by using IValueConverter:

Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource YearConverter}}"

Hope this helps.

Regards,
Geri
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
RR
Top achievements
Rank 1
answered on 20 Mar 2015, 01:20 PM
Hi teri

I have used the style of rad Calendar in a  seperate style file. There  in  <Style x:Key="CalendarHeaderButton" TargetType="Button">   I have 
<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"/>

How can I add the converter there. It says " property converter was not found in type 'templatebinding'"

Thank you..
0
Geri
Telerik team
answered on 23 Mar 2015, 02:44 PM
Hello Roshan,

In order to use the value converter, you need to replace TemplateBinding with Binding and set the RelativeSource as shown in the code below:

Text="{Binding Content, RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource YearConverter}}"

Hope this helps.

Regards,
Geri
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Calendar
Asked by
RR
Top achievements
Rank 1
Answers by
Geri
Telerik team
RR
Top achievements
Rank 1
Share this question
or