XamForms.Controls.Calendar icon indicating copy to clipboard operation
XamForms.Controls.Calendar copied to clipboard

Disable specific datesq

Open rodrigueslg opened this issue 6 years ago • 1 comments

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}" />

rodrigueslg avatar Jul 03 '18 21:07 rodrigueslg

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} } } }); } }

lijusparkt avatar Oct 23 '19 10:10 lijusparkt