New to Telerik UI for WPFStart a free 30-day trial

Special Slots

Updated on Sep 24, 2025

RadTimeline provides an easy way to mark certain intervals along the visible range of the control as special slots. This is done through a custom RangeGenerator class which implements ITimeRangeGenerator interface. This interface defines the GetRanges() method. Given the current visible period, this method returns IEnumerable - an array of PeriodSpan instances each of which defines a special slot with a start and end date. E.g. new PeriodSpan(System.DateTime date, System.TimeSpan slotSpan)

Below you can find a sample weekends generator implementation:

C#
	using Telerik.Windows.Controls;
	using Telerik.Windows.Controls.TimeBar;

	public class WeekendsGenerator : ITimeRangeGenerator
	{
	  public System.Collections.Generic.IEnumerable<IPeriodSpan> GetRanges(SelectionRange<DateTime> visibleRange)
	  {
		  TimeSpan slotSpan = TimeSpan.FromDays(2);
		  var differenceFirstVisible = DayOfWeek.Saturday - visibleRange.Start.DayOfWeek;
		  DateTime day = new DateTime(visibleRange.Start.Year, visibleRange.Start.Month, visibleRange.Start.Day);

		  for (DateTime current = day.AddDays(differenceFirstVisible); current < visibleRange.End; current += TimeSpan.FromDays(7))
		  {
			  yield return new PeriodSpan(current, slotSpan);
		  }
	  }
	}

Using the SpecialSlotsGenerator property of the RadTimeline control you can specify a custom ITimeRangeGenerator instance that defines certain time intervals as special. The example below shows how you can specify a time range generator for a RadTimeline control:

XAML
	<telerik:RadTimeline PeriodStart="1-Jan-2010" PeriodEnd="1-Jan-2011">
		<telerik:RadTimeline.SpecialSlotsGenerator>
		  <example:WeekendsGenerator />
		</telerik:RadTimeline.SpecialSlotsGenerator>
		<telerik:RadTimeline.Intervals>
		  <telerik:MonthInterval />
		  <telerik:DayInterval />
		</telerik:RadTimeline.Intervals>
	</telerik:RadTimeline>

Using the sample weekends generator above, you will get the following result: Rad Timeline-features-special-slots

See Also

In this article
See Also
Not finding the help you need?
Contact Support