lilcodelab / Xamarin.Plugin.Calendar

Calendar plugin for Xamarin.Forms
MIT License
260 stars 61 forks source link

[Bug] Some properties do not behave as expected #72

Open kuririn2001 opened 3 years ago

kuririn2001 commented 3 years ago

Hello. I'm using your Calendar control. Thank you very much. I have 2 concerns and will report them along with the code (please feel free to use the code). The platforms are iOS and Android. The source code and bugs are based on version 1.2.2936 of Calendar Plugin for Xamarin.

Thank you very much.

antonioseric commented 3 years ago

@kuririn2001 can you test this in latest nuget release?

kuririn2001 commented 3 years ago

Hello.

I'm sorry I haven't been able to respond to your questions, I've been busy with work. Thank you for fixing the Calendar control. I tested the DaysTitleColor property. The version is 1.4.5304. This worked fine. In addition to this, I also tried using the DeselectedDayTextColor property, which is also OK.

Next, the SelectedDateTextFormat property. This also worked well. Thank you for the correction. As for the above, I think the problem is good to be closed.

However, it seems that the OtherMonthDayIsVisible property is not working in this version 1.4.5304. In the sample program AdvancedPage.xaml(ADVANCED EVENT CALENDAR), this property is set to False, but the dates of the previous and following months are displayed. It worked fine in the previous version 1.2.2936. It would be great if you could fix it.

Well, thank you very much.

ali-h2010 commented 2 years ago

I fixed this by updating the DayViewSize to 0 if it's not in this month as the following: https://github.com/lilcodelab/Xamarin.Plugin.Calendar/blob/2fc44d910aedb6affe42ff24e80a6a884712ab1a/src/Calendar.Plugin/Shared/Controls/MonthDaysView.cs#L624

            foreach (var dayView in _dayViews)
            {
                var currentDate = firstDate.AddDays(addDays++);
                var dayModel = dayView.BindingContext as DayModel;
                dayModel.Date = currentDate.Date;
                dayModel.DayTappedCommand = DayTappedCommand;
                dayModel.EventIndicatorType = EventIndicatorType;                
                dayModel.DayViewCornerRadius = DayViewCornerRadius;
                dayModel.DaysLabelStyle = DaysLabelStyle;
                dayModel.OtherMonthIsVisible = (CalendarLayout != WeekLayout.Month) || OtherMonthDayIsVisible;
                dayModel.IsThisMonth = (CalendarLayout != WeekLayout.Month) || currentDate.Month == ShownDate.Month;
                if(dayModel.OtherMonthIsVisible)
                {
                    dayModel.DayViewSize = DayViewSize;
                }
                else
                {
                    if (!dayModel.IsThisMonth)
                    {
                        dayModel.DayViewSize = 0;
                    }
                    else
                    {
                        dayModel.DayViewSize = DayViewSize;
                    }
                }
                dayModel.HasEvents = Events.ContainsKey(currentDate);
                dayModel.IsDisabled = currentDate < MinimumDate || currentDate > MaximumDate;

                ChangePropertySilently(nameof(dayModel.IsSelected), () => dayModel.IsSelected = CurrentSelectionEngine.IsDateSelected(dayModel.Date));
                AssignIndicatorColors(ref dayModel);
            }