With the new SP1 release of Q3 2010 we added a new feature to RadScheduleView that helps you customize every slot in a different way.custom slots

To do that you should create an instance of the Slot class, set its Start and  End  properties,


the Resources property - with this property you can define in which resource column the slot will be displayed,

and the RecurrencePattern property - with this property you can define whether the slot will be displayed for repeating days or events like Christmas, WeekendDays  and Birthdays.


For example let's say that we have a schedule control and want to customize the days that are holidays.

To do that we create slots for Christmas, Saint Valentine and Halloween days:
var christmasSlot = new Slot() { Start = new DateTime(2010, 12, 25), End = new DateTime(2010, 12, 26) };
            christmasSlot.RecurrencePattern = new RecurrencePattern();
            christmasSlot.RecurrencePattern.Interval = 1;
            christmasSlot.RecurrencePattern.Frequency = RecurrenceFrequency.Yearly;
            christmasSlot.RecurrencePattern.DayOfMonth = 25;
            christmasSlot.RecurrencePattern.MonthOfYear = 12;
            SpecialSlots.Add(christmasSlot);
 
            var valentineSlot = new Slot() { Start = new DateTime(2010, 2, 14), End = new DateTime(2010, 2, 15) };
            valentineSlot.RecurrencePattern = new RecurrencePattern();
            valentineSlot.RecurrencePattern.Interval = 1;
            valentineSlot.RecurrencePattern.Frequency = RecurrenceFrequency.Yearly;
            valentineSlot.RecurrencePattern.DayOfMonth = 14;
            valentineSlot.RecurrencePattern.MonthOfYear = 2;
            SpecialSlots.Add(valentineSlot);

When we are ready we should add the slots to the SpecialSlotsSource property of the control.

 The only thing left is to assign a style for Christmas, Halloween and St.Valentine. RadScheduleView has SpecialSlotsStyleSelector property that we will use for this task:

<telerik:RadScheduleView Grid.Column="1" Grid.Row="0"
                             x:Name="scheduleView"
                             SpecialSlotsSource="{Binding SpecialSlots}"
                             AppointmentsSource="{Binding Appointments}"
                             SpecialSlotStyleSelector="{StaticResource HolidayStyleSelector}"
                             Margin="10 0 10 0">
        <telerik:RadScheduleView.ViewDefinitions>
            <telerik:MonthViewDefinition />
        </telerik:RadScheduleView.ViewDefinitions>
    </telerik:RadScheduleView>

 You can now download the full project here , see another example using special slots in our online demos and start customizing the slots in your own unique way.


Rossitza-Fakalieva
About the Author

Rossitza Fakalieva

Rossitza Fakalieva is Manager of the Progress Desktop UI & Tools division, which develops the UI for WPF, UI for WinForms and Telerik Reporting products. She started her career on the Telerik ASP.NET team in 2006 as a support officer and passed through the position of software developer to the position of senior manager. Off work, she enjoys cooking, watching movies and reading books.

Comments

Comments are disabled in preview mode.