Welcome to the Xamarin.Forms feedback portal. We’re happy you’re here! If you have feedback on how to improve the Xamarin.Forms, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
Hello,
I am using a SFCalendar control in one of my page to show the week view. It has two navigation buttons on the side which calls Forward and Backward methods of the control, which triggers
When I call Forward or Backward method, the control displays the next or previous week Date respectively, but the OnMonthCellLoaded event args are completely showing the wrong date.
For ex:
If my control is currently displaying a date between 2019/01/19 to 2019/01/25 (Weekview) then when I call control.Backward(), the control properly displays a previous week with date between 2019/01/12 to 2019/01/18, but when the OnMonthCellLoaded event is triggered (7 times) the args date value goes one more week behind and date value starts from 2019/01/05 to 2019/01/11 (But what control displays a proper date).
<calendar:SfCalendar x:Name="TimeCalendar" Grid.Row="0" ShowYearView="False" ToggleDaySelection="True"
FirstDayofWeek="{Binding FirstDayofWeek}"
NumberOfWeeksInView="1"
AgendaViewHeight="0" ViewMode="MonthView"
EnableSwiping="True" SelectionMode="SingleSelection"
MonthChangedCommand="{Binding MonthViewChangedCommand}"
SelectedDate="{Binding SelectedDate}"
SelectionChangedCommand="{Binding SelectedDateChangedCommand}">
<calendar:SfCalendar.Behaviors>
<behaviors:EventToCommandBehavior EventName="OnMonthCellLoaded"
Command="{Binding MonthCellLoadedCommand}"
EventArgsConverter="{StaticResource monthCellLoadedEventArgsConverter}" />
</calendar:SfCalendar.Behaviors>
<calendar:SfCalendar.HeaderView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="70" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ImageButton Grid.Column="0" Source="{StaticResource ic_navigate_before_white_24}" Margin="10"
Aspect="Fill" Command="{Binding NavigateCalendarWeek}"
CommandParameter="{StaticResource falseValue}" BackgroundColor="Gray" />
<Label Grid.Column="1" Text="{Binding CalendarHeaderDate}" TextColor="Black"
HorizontalTextAlignment="Center" VerticalTextAlignment="Center" FontAttributes="Bold"
FontSize="Large" />
<ImageButton Grid.Column="2" Margin="10" Source="{StaticResource ic_navigate_next_white_24}"
Command="{Binding NavigateCalendarWeek}" BackgroundColor="Gray" Aspect="Fill"
CommandParameter="{StaticResource trueValue}" />
</Grid>
</calendar:SfCalendar.HeaderView>
......
private void CreateMonthCellView(object obj)
{
var e = (MonthCellLoadedEventArgs) obj;
var labelTotal = new Label
{
Text = TimeEntryCollection.Where(x => x.DateBooked.Date == e.Date.Date).Sum(x => x.RegularHours).ToString()
};
var labelDay = new Label
{
Text = e.Date.Day.ToString(CultureInfo.InvariantCulture), FontAttributes = };
...........
}