Open kuririn2001 opened 3 years ago
@kuririn2001 can you test this in latest nuget release?
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.
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);
}
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.
Setting AppThemeBinding to DaysTitleColor and switching between dark mode and light mode is not reflected. Reproduction Procedure: 0.Add the properties "TextColorLight" and "TextColorDark" to App.xaml in advance.
Even if you set the SelectedDateTextFormat property (for example, "yyyy/MM/dd (ddd)"), the first time the date is displayed, it will be formatted as "d MMM yyyy", which is the default setting. This can be reproduced with the Simple and Advanced programs that are included as samples. Reproduce the following steps.
In SampleApp/Views/SimplePage.xaml, add the SelectedDateTextFormat to the plugin:Calendar section as follows. <plugin:Calendar Padding="10,0" Events="{Binding Events}" HorizontalOptions="FillAndExpand" MaximumDate="{Binding MaximumDate}" MinimumDate="{Binding MinimumDate}" Month="{Binding Month}" SelectedDate="{Binding SelectedDate}" VerticalOptions="FillAndExpand" SelectedDateTextFormat="yyyy/MM/dd (ddd)" <- Add this
Compile and display the calendar.
The date format displayed below the calendar will be in "d MMM yyyy" format (e.g., 1 Jan 2021).
Tap the appropriate date. Then, the date will be displayed in the format you set in SelectedDateTextFormat, and you will be able to see the date. Even if you tap other dates below, the date will be displayed in the format set by SelectedDateTextFormat.
The modified code is as follows. (It's not a large amount, so I'll write it here.) CalendarPlugin/Shared/Controls/Calendar.xaml.cs From around line 354
old source: public static readonly BindableProperty SelectedDateTextFormatProperty = BindableProperty.Create(nameof(SelectedDateTextFormat), typeof(string), typeof(Calendar), "d MMM yyyy");
new source: public static readonly BindableProperty SelectedDateTextFormatProperty = BindableProperty.Create(nameof(SelectedDateTextFormat), typeof(string), typeof(Calendar), "d MMM yyyy", propertyChanged: (bindable, oldValue, newValue) => (bindable as Calendar).ChangeSelectedDateTextFormat((string)newValue, (string)oldValue));
Thank you very much.