Hello,
I found that when the SfCalendar control is placed in the Header of a CollectionView, the MonthChangedCommand command fires multiple times when swiping months back and forth.
I was able to reproduce it on Android (didn't try iOS). Please see the attached repro project. Run it on an android device and start swiping to the previous month and back to the current. Keep watching what is happening in the Debug output.
Also another related question - why the MonthChangedCommand is called on a NON-UI thread? Is it a bug or expected behaviour?
Thank you!
Kind regards,
Valeriy
|
void HandleMonthChanged(MonthChangedEventArgs e)
{
Debug.WriteLine("SELECTED MONTH CHANGED " + e.PreviousValue + " " + e.CurrentValue);
}
public ViewModel()
{
this.Appointments = new CalendarEventCollection();
this.AddAppointmentDetails();
this.AddAppointments();
SetItems();
} |
Hi Muniappan,
Thanks for getting back to me! Well, that doesn't really help me because in my case items in the CollectionView have to be updated based on the currently selected month. So `SetItems()` has to be called each time as it was in my example.
If I put it back into the HandleMonthChanged method, I see the issue with multiple calls.
Is there anything I can do to work around this?
Kind regards,
Valeriy
Hi SaiGanesh,
Thank you for keeping me posted!
Kind regards,
Valeriy
Hi SaiGanesh,
Thanks for getting back to me. Yes, I was considering this workaround, but in this case on smaller screens there are too little space left (since the calendar doesn't scroll away and always stays on top) and UX is not great (considering a long list of elements in the collection view).
I wonder if you may suggest any directions where to look for a fix/workaround to make it work within the header view?
Kind regards,
Valeriy
Hi SaiGanesh,
Your explanation helped me to find a workaround - if I don't use Clear() or ReplaceRange(..) but delete items one buy one, there is no multiple calls. I'm going to stick with this workaround unless you can suggest any better way to handle this.
Kind regards,
Valeriy