Skip to content

Scheduler | Custom Templates

All scheduler views support custom DataTemplate properties to override the default visual elements. Templates must use AOT-safe static lambda bindings — never string-based SetBinding().

The DefaultTemplates static class provides reusable template factories:

MethodBinds ToDescription
CreateEventItemTemplate()SchedulerEventColor bar + title label
CreateOverflowTemplate()CalendarOverflowContext”+N more” overflow label
CreateLoaderTemplate()NoneActivityIndicator + “Loading…”
CreateCalendarListDayHeaderTemplate()CalendarListDayGroupAccent bar + today dot + bold date + event count
CreateCalendarListEventItemTemplate()SchedulerEventCard with color bar, title, description, time range
CreateAppleCalendarDayPickerTemplate()DatePickerItemContextApple Calendar-style day picker (default for Agenda)

Used by EventItemTemplate on all views:

public class SchedulerEvent
{
public string Identifier { get; set; }
public string Title { get; set; }
public string? Description { get; set; }
public Color? Color { get; set; }
public bool IsAllDay { get; set; }
public DateTimeOffset Start { get; set; }
public DateTimeOffset End { get; set; }
}

Used by DayHeaderTemplate on SchedulerCalendarListView:

public class CalendarListDayGroup : List<SchedulerEvent>
{
public DateOnly Date { get; }
public string DateDisplay { get; } // "dddd, MMMM d, yyyy"
public bool IsToday { get; }
public string EventCountDisplay { get; } // "3 events"
}

Used by DayPickerItemTemplate on SchedulerAgendaView:

public class DatePickerItemContext
{
public DateOnly Date { get; set; }
public string DayNumber { get; set; } // "30"
public string DayName { get; set; } // "MON"
public string MonthName { get; set; } // "MAR"
public bool IsSelected { get; set; }
public bool IsToday { get; set; }
}

Used by OverflowItemTemplate on SchedulerCalendarView:

public class CalendarOverflowContext
{
public int EventCount { get; set; }
public DateOnly Date { get; set; }
}

Always use the static lambda overload of SetBinding():

// Correct — AOT safe
label.SetBinding(Label.TextProperty, static (SchedulerEvent e) => e.Title);
// WRONG — not AOT safe, will fail in trimmed/AOT builds
label.SetBinding(Label.TextProperty, "Title");
var template = new DataTemplate(() =>
{
var grid = new Grid
{
ColumnDefinitions =
{
new ColumnDefinition(new GridLength(4)),
new ColumnDefinition(GridLength.Star)
},
Padding = new Thickness(8),
ColumnSpacing = 8
};
var colorBar = new BoxView { CornerRadius = 2 };
colorBar.SetBinding(BoxView.ColorProperty, static (SchedulerEvent e) => e.Color);
var stack = new VerticalStackLayout { Spacing = 2 };
var title = new Label { FontSize = 14, FontAttributes = FontAttributes.Bold };
title.SetBinding(Label.TextProperty, static (SchedulerEvent e) => e.Title);
var description = new Label { FontSize = 12, TextColor = Colors.Gray };
description.SetBinding(Label.TextProperty, static (SchedulerEvent e) => e.Description);
stack.Children.Add(title);
stack.Children.Add(description);
grid.Add(colorBar, 0);
grid.Add(stack, 1);
return grid;
});
var template = new DataTemplate(() =>
{
var stack = new VerticalStackLayout
{
Spacing = 2,
Padding = new Thickness(8, 4),
HorizontalOptions = LayoutOptions.Center
};
var dayName = new Label
{
FontSize = 10,
HorizontalTextAlignment = TextAlignment.Center,
TextColor = Colors.Gray
};
dayName.SetBinding(Label.TextProperty, static (DatePickerItemContext c) => c.DayName);
var dayNumber = new Label
{
FontSize = 18,
FontAttributes = FontAttributes.Bold,
HorizontalTextAlignment = TextAlignment.Center
};
dayNumber.SetBinding(Label.TextProperty, static (DatePickerItemContext c) => c.DayNumber);
stack.Children.Add(dayName);
stack.Children.Add(dayNumber);
return stack;
});
var template = new DataTemplate(() =>
{
var stack = new VerticalStackLayout
{
VerticalOptions = LayoutOptions.Center,
HorizontalOptions = LayoutOptions.Center,
Spacing = 8
};
stack.Children.Add(new ActivityIndicator { IsRunning = true, Color = Colors.DodgerBlue });
stack.Children.Add(new Label { Text = "Fetching events...", TextColor = Colors.Gray });
return stack;
});
ViewTemplate Properties
SchedulerCalendarViewEventItemTemplate, OverflowItemTemplate, LoaderTemplate
SchedulerAgendaViewEventItemTemplate, DayPickerItemTemplate, LoaderTemplate
SchedulerCalendarListViewEventItemTemplate, DayHeaderTemplate, LoaderTemplate