Telerik UI for Windows Phone by Progress

To allow full templating and special days support RadCalendar defines 2 properties – ItemTemplate and ItemTemplateSelector.

By using the ItemTemplate you can specify how each of the days will be rendered. The DataContext of each day is of type Telerik.Windows.Controls.CalendarButtonContentInfo.

Here is a sample data template for a day:

CopyXAML
<telerikInput:RadCalendar>
  <telerikInput:RadCalendar.ItemTemplate>
    <DataTemplate>
      <Grid Margin="5">
        <TextBlock Text="{Binding DetailText}" FontSize="7" MaxHeight="25" VerticalAlignment="Top" Margin="0,-2,0,0" />
        <TextBlock Text="{Binding Text}" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
      </Grid>
    </DataTemplate>
  </telerikInput:RadCalendar.ItemTemplate>
</telerikInput:RadCalendar>

Using ItemTemplateSelector

To mark specific day or days with as a special RadCalendar provides an ItemTemplateSelector property. Here how to create simple template selector and to mark the non-working days as special:

CopyXAML
<?xml version="1.0" encoding="utf-8"?>
<UserControl.Resources>
  <local:WeekendDaySelector x:Key="WeekendDaySelector">
    <local:WeekendDaySelector.SpecialTemplate>
      <DataTemplate>
        <Grid Margin="5">
          <Image Source="/Calendar/Images/SpecialDay.png" Width="24" Height="24" />
          <TextBlock Text="{Binding Text}" x:Name="TextPresenter" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
        </Grid>
      </DataTemplate>
    </local:WeekendDaySelector.SpecialTemplate>
  </local:WeekendDaySelector>
</UserControl.Resources>

<telerikInput:RadCalendar ItemTemplateSelector="{StaticResource WeekendDaySelector}" />
CopyC#
public class WeekendDaySelector : DataTemplateSelector
{
    public DataTemplate SpecialTemplate
    {
        get;
          set;
    }

    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        CalendarButtonContentInfo info = item as CalendarButtonContentInfo;
          CalendarButton button = container as CalendarButton;
          if (!button.IsFromCurrentView) return null;
          if (info.Date == null) return null;
          if (info.Date.Value.DayOfWeek == DayOfWeek.Saturday ||
              info.Date.Value.DayOfWeek == DayOfWeek.Sunday)
          {
               return SpecialTemplate;
          }
          return base.SelectTemplate(item, container);
    }
}
CopyVB.NET
Public Class WeekendDaySelector
    Inherits DataTemplateSelector

    Private Property SpecialTemplate As DataTemplate

    Public Overrides Function SelectTemplate(item As Object, container As System.Windows.DependencyObject) As System.Windows.DataTemplate
        Dim info As CalendarButtonContentInfo = DirectCast(item, CalendarButtonContentInfo)
        Dim button As CalendarButton = DirectCast(container, CalendarButton)

        If Not button.IsFromCurrentView Then
            Return Nothing
        End If

        If (info.Date Is Nothing) Then
            Return Nothing
        End If

        If (info.Date.Value.DayOfWeek = DayOfWeek.Saturday Or
            info.Date.Value.DayOfWeek = DayOfWeek.Sunday) Then
            Return Me.SpecialTemplate
        End If

        Return MyBase.SelectTemplate(item, container)
    End Function
End Class