ComponentOne Calendar for UWP
Calendar for UWP Task-Based Help / Customizing Days Using DaySlotTemplateSelector
In This Topic
    Customizing Days Using DaySlotTemplateSelector
    In This Topic

    To customize the color of Sundays' and today's date, add the following:

    To write the code in Visual Basic:

    Visual Basic
    Copy Code
    ' show Sundays in Red and Today’s date in Green
    Dim datesSelector As DaySlotTemplateSelector = TryCast(Me.Resources("DaySlotTemplateSelector"), DaySlotTemplateSelector)
    cal1.DaySlotTemplateSelector = datesSelector
    ' use bolded days dictionary defined in the DaySlotTemplateSelector class instance
    Me._boldedDays = datesSelector.BoldedDays
    cal1.DayOfWeekSlotTemplateSelector = New DayOfWeekTemplateSelector()
    cal1.WeekendBrush = New SolidColorBrush(Colors.Red)
    cal1.TodayBrush = New SolidColorBrush(Colors.Green)
    

    To write the code in C#:

    C#
    Copy Code
    // show Sundays in Red and Today’s Date in Green
                DaySlotTemplateSelector datesSelector = this.Resources["DaySlotTemplateSelector"] as DaySlotTemplateSelector;
                cal1.DaySlotTemplateSelector = datesSelector;
                // use bolded days dictionary defined in the DaySlotTemplateSelector class instance
                this._boldedDays = datesSelector.BoldedDays;
                cal1.DayOfWeekSlotTemplateSelector = new DayOfWeekTemplateSelector();
                cal1.WeekendBrush = new SolidColorBrush(Colors.Red);
                cal1.TodayBrush = new SolidColorBrush(Colors.Green);
    }