Skip to content

How to highlight particular days in Calendar? #13642

Discussion options

You must be logged in to vote

With your inputs I managed to get what I needed. I use DateOnly[] to store the dates that I want to highlight, then I change the background color of the CalendarDayButton if it contains one of the stored dates. Thanks!

public class HighlightedCalendar : Avalonia.Controls.Calendar
{
    public DateOnly[] HighlightedDates { get; set; }

    protected override Type StyleKeyOverride => typeof(Avalonia.Controls.Calendar);
}

public class HighlightedDateMultiConverter : IMultiValueConverter
{
    public object Convert(IList<object> values, Type targetType, object parameter, CultureInfo culture)
    {
        if (values is [DateTime date, HighlightedCalendar calendar])
        {
            var …

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@alessandrofrancesconi
Comment options

@timunie
Comment options

Comment options

You must be logged in to vote
4 replies
@timunie
Comment options

@alessandrofrancesconi
Comment options

Answer selected by alessandrofrancesconi
@maxkatz6
Comment options

@rickx
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants