Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable specific datesq #83

Open
rodrigueslg opened this issue Jul 3, 2018 · 1 comment
Open

Disable specific datesq #83

rodrigueslg opened this issue Jul 3, 2018 · 1 comment

Comments

@rodrigueslg
Copy link

rodrigueslg commented Jul 3, 2018

Is there any way to disable specific dates?

sample:

var disabledDates = new List<DateTime>() { new DateTime(2018, 06, 11),
                                                          new DateTime(2018, 06, 13),
                                                          new DateTime(2018, 06, 14),
                                                          new DateTime(2018, 06, 25)
                                                        };

<controls:Calendar DisabledDates="{Binding DisabledDates}" />
@lijusparkt
Copy link

lijusparkt commented Oct 23, 2019

Hi @rodrigueslg ,
It's possible . Try this code; Here you can add special dates if it is SAT or SUN and set your special dates are "Un selectable"

for (DateTime i = MinimumDate; i < MinimumDate.AddMonths(2); i = i.AddDays(1))
{
if ((i.DayOfWeek == DayOfWeek.Saturday) || (i.DayOfWeek == DayOfWeek.Sunday))
{
SpecDate.Add(new SpecialDate(i)
{
TextColor = Color.Gray,
Selectable = false,
FontSize = 10,
BackgroundPattern = new BackgroundPattern(1)
{
Pattern = new List
{
new Pattern{ WidthPercent = 1f, HightPercent = 1f, Color = Color.Transparent,Text = "", TextSize =11, TextAlign=TextAlign.CenterBottom}
}
}
});
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants