-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Calendar ignores value of NavigationLowerBound #171
Comments
I'm surprised it took this long for this to be uncovered, nice catch. A new version with the fix will be released in the next few hours. |
Should be fixed by #172 in version 4.5.4 of XCalendar.Core |
I see in your images and code that you've set the lower bound to "Today". The default behavior of the calendar is to loop to the upper bound once you reach the lower bound, and since you haven't set an upper bound, it goes to DateTime.MaxValue and that's why it displays December 9999. I don't know why all the dates are the same though, I'll look into that. What does your XAML look like? |
Setting the lower bound works fine in the "Getting Started" repo. The dates below the minimum turn red as they should. |
Here's my code. It works fine on previous versions as soon as I upgrade to the latest version I get the issue with the dates <calendar:CalendarView
x:Name="FancyCalendarView"
LeftArrowCommand="{Binding NavigateCalendarCommand, Source={x:Reference this}}"
Days="{Binding MyCalendar.Days, Source={x:Reference this}}"
DaysOfWeek="{Binding MyCalendar.DayNamesOrder, Source={x:Reference this}}"
RightArrowCommand="{Binding NavigateCalendarCommand, Source={x:Reference this}}"
NavigatedDate="{Binding MyCalendar.NavigatedDate, Source={x:Reference this}}">
<calendar:CalendarView.RightArrowCommandParameter>
<x:Int32>1</x:Int32>
</calendar:CalendarView.RightArrowCommandParameter>
<calendar:CalendarView.LeftArrowCommandParameter>
<x:Int32>-1</x:Int32>
</calendar:CalendarView.LeftArrowCommandParameter>
<calendar:CalendarView.NavigationViewTemplate>
<ControlTemplate>
<calendar:NavigationView
LeftArrowCommand="{Binding LeftArrowCommand, Source={x:RelativeSource TemplatedParent}}"
LeftArrowCommandParameter="{Binding LeftArrowCommandParameter, Source={RelativeSource TemplatedParent}}"
RightArrowCommand="{Binding RightArrowCommand, Source={x:RelativeSource TemplatedParent}}"
RightArrowCommandParameter="{Binding RightArrowCommandParameter, Source={RelativeSource TemplatedParent}}"
HeightRequest="40"
ArrowColor="DarkGray"
TextColor="Black"
Text="{Binding Text, Source={RelativeSource TemplatedParent}}"/>
</ControlTemplate>
</calendar:CalendarView.NavigationViewTemplate>
<calendar:CalendarView.DayTemplate>
<DataTemplate x:DataType="{x:Type xcInterfaces:ICalendarDay}">
<ContentView>
<Frame
Padding="0"
CornerRadius="0"
HasShadow="False">
<calendar:DayView
DateTime="{Binding DateTime}"
IsCurrentMonth="{Binding IsCurrentMonth}"
IsInvalid="{Binding IsInvalid}"
IsSelected="{Binding IsSelected}"
IsToday="{Binding IsToday}">
<calendar:DayView.InvalidStyle>
<Style TargetType="{x:Type calendar:DayView}">
<Setter Property="HeightRequest" Value="50" />
<Setter Property="TextColor" Value="LightGray" />
</Style>
</calendar:DayView.InvalidStyle>
<calendar:DayView.OtherMonthStyle>
<Style TargetType="{x:Type calendar:DayView}">
<Setter Property="HeightRequest" Value="50" />
<Setter Property="TextColor" Value="Transparent" />
</Style>
</calendar:DayView.OtherMonthStyle>
<calendar:DayView.CurrentMonthStyle>
<Style TargetType="{x:Type calendar:DayView}">
<Setter Property="Command" Value="{Binding ChangeDateSelectionCommand, Source={x:Reference this}}"/>
<Setter Property="CommandParameter" Value="{Binding DateTime}"/>
<Setter Property="HeightRequest" Value="50" />
<Setter Property="TextColor" Value="Black" />
</Style>
</calendar:DayView.CurrentMonthStyle>
<calendar:DayView.TodayStyle>
<Style TargetType="{x:Type calendar:DayView}">
<Setter Property="Command" Value="{Binding ChangeDateSelectionCommand, Source={x:Reference this}}"/>
<Setter Property="CommandParameter" Value="{Binding DateTime}"/>
<Setter Property="TextColor" Value="Black"/>
<Setter Property="FontFamily" Value="Inter-Bold" />
</Style>
</calendar:DayView.TodayStyle>
<calendar:DayView.SelectedStyle>
<Style TargetType="{x:Type calendar:DayView}">
<Setter Property="Command" Value="{Binding ChangeDateSelectionCommand, Source={x:Reference this}}"/>
<Setter Property="CommandParameter" Value="{Binding DateTime}"/>
<Setter Property="BackgroundColor" Value="#FC8300"/>
<Setter Property="TextColor" Value="White"/>
<Setter Property="HeightRequest" Value="50" />
</Style>
</calendar:DayView.SelectedStyle>
</calendar:DayView>
</Frame>
</ContentView>
</DataTemplate>
</calendar:CalendarView.DayTemplate>
</calendar:CalendarView> |
I replaced the code in the getting started app with yours. I renamed the namespace "xc" to "calendar" so it would match your XAML.
The dates seem to show fine - each day has the correct date. The invalid dates are grey, the current ones are black, and the other month ones are invisible. I wasn't able to replicate your issue with the same date repeating. This was on XCalendar.Maui 4.6.0 running on Windows 10. |
@pjdavid Have you managed to get it working correctly by applying the 1st (and 3rd if you're using a ViewModel) changes I mentioned? |
I'm testing this implementation today. I had to downgrade for now but today I'm going to update again to try your suggestions |
@pjdavid Are you still experiencing this issue? |
Original Issue:
ME-MarvinE/XCalendarGettingStarted#2
The text was updated successfully, but these errors were encountered: