How to use Calendar events with MVVM?

Hi, I am working on this app that is all based on MVVM, so I was wondering how I can use calendar events such as:
  • OnCalendarTapped
  • SelectionChanged
  • MonthChanged
  • OnDateCellHolding
  • etc. etc.
Ideally i'd like to be able to do something like this:

<sfCalendar:SfCalendar ViewMode="MonthView" ShowYearView="True" SelectionChanged="{Binding CalendarSelectionChangedEvent}"></sfCalendar:SfCalendar>

What I cannot have is pure code behind, I can only use the ViewModel.
How can I do that?

7 Replies

VA Vinnalan Aravazhi Syncfusion Team April 11, 2018 07:24 AM UTC

Hi Cristian,

We have checked your requirement "To use Calendar events with MVVM" from our side and we have created a sample based on your requirement. In this sample we use Behaviors to achieve your requirement. Please find the sample from below link.

Sample: https://www.syncfusion.com/downloads/support/forum/136933/ze/DateSelection1938829968 

Please let us know if you have any other queries.

Regards,
Vinnalan K A.
 



CM Cristian Merli April 11, 2018 05:07 PM UTC

Oh ok thank you, I'll give it a try with behaviors.

Another question is, is it possible to have arrows in the header to navigate, in addition to swiping left and right?

Example: https://i.pinimg.com/originals/23/d4/74/23d474d0469b13a34a053deece4f1505.png


VA Vinnalan Aravazhi Syncfusion Team April 12, 2018 06:51 AM UTC

Hi Cristian,

Thanks for the update.

Query: Is it possible to have arrows in the header to navigate.

We have checked your requirement from our side. ShowNavigationButtons property is used to enable NavigationButtons in SfCalendar. Please find the sample from below link.

Sample: https://www.syncfusion.com/downloads/support/forum/136933/ze/DateSelection593068854 

Please let us know if you have any other queries.

Regards,
Vinnalan K A.

 



CM Cristian Merli April 13, 2018 08:35 PM UTC

Hi thanks, is the same possible for the SfSchedule control?
I don't see that property in SfSchedule and EnableNavigation="True" doesn't seem to make a difference.

The ShowNavigationButtons="true" is what i was looking for in the SfCalendar, but it seems very slow. After i tap on the left or right arrows it takes 2-3 seconds to change month. Is that normal?


VA Vinnalan Aravazhi Syncfusion Team April 16, 2018 11:32 AM UTC

Hi Cristian,

Thanks for the update.

Query 1: ShowNavigationButtons possible for the SfSchedule control?

SfSchedule doesn’t conatin ShowNavigationButtons property and NavigationButtons to navigate. It can be achieved by using custom headers along with Forward and Backward methods. EnableNavigation property is used to enable or disable the left and right swiping using touch swipe gesture.

You can also refer our online User Guide Documentation by using the below link,

https://help.syncfusion.com/xamarin/sfschedule/headers#loading-custom-headers

https://help.syncfusion.com/xamarin/sfschedule/date-navigations#programmatically-change-to-adjacent-dates

https://help.syncfusion.com/xamarin/sfschedule/date-navigations#enabling-navigation

Please let us know if you need further assistance on this.

Query 2: ShowNavigationButtons="true" is what i was looking for in the SfCalendar, but it seems very slow

We have checked the reported issue and we are unable to reproduce the reported issue from our side. We have attached the sample in which we have checked the reported issue from our side. Please find the sample from below link. 
  

So, could you please provide below mentioned details,

1) Modified sample which replicates the reported issue.
2) Which platform, version and device model reported issue gets occur.

It will help us to provide appropriate solution on this.

Regards,
Vinnalan K A. 



CM Cristian Merli April 17, 2018 06:23 PM UTC

Is there a plan to make those events into Commands?


VA Vinnalan Aravazhi Syncfusion Team April 18, 2018 04:58 PM UTC

Hi Cristian,

Thanks for the update.

Query: Is there a plan to make those events into Commands?

We have checked the reported requirement from our side and In our current implementation we don’t have Support to make OnCalendarTapped, SelectionChanged, MonthChanged and OnDateCellHolding events into Commands. So, We have considered this as a feature and logged feature report. It will be available any of our upcoming Volume releases.

Please check our website periodically to know the status of the features that are implemented.

Regards,
Vinnalan K A.


Loader.
Up arrow icon