Forum Xamarin.Forms

Extended DatePicker? How to disable certains days from DatePicker?

LuisAplitoLuisAplito DOMember ✭✭
edited September 2017 in Xamarin.Forms

Hello there, I'm trying to disable certain days, like weekends, from a datepicker, but it seems I can only set min and max selectable dates. Is there anyway to achieve that? or is there any compatible XForms Nuget Package that allows me to do it?

Answers

  • JaaqJaaq MXMember ✭✭

    any update?

  • LuisAplitoLuisAplito DOMember ✭✭
    I managed to get it done using Syncfusion Calendar, they got some free controls por XF.
  • LijuDanielLijuDaniel Member ✭✭

    I think Syncfusion is Paid one ; It's Possible with another control :smile: "XamForms.Controls.Calendar"
    github.com/rebeccaXam/XamForms.Controls.Calendar/wiki

    Here you can add special dates in this control; if it is SAT or SUN then set your special dates and its property Selectable = false

    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}
    }
    }
    });
    }
    }
    
  • PrabakaranRamasamyPrabakaranRamasamy USMember ✭✭✭

    If you are eligible for a Community license, then you can get all the Syncfusion controls free of charge.

    https://www.syncfusion.com/products/communitylicense

Sign In or Register to comment.