yurkinh / Plugin.Maui.Calendar

.NET MAUI port of XF calendar plugin
MIT License
122 stars 11 forks source link

Raising ICommand and passing DateTime from the selected date after the user selects a date #78

Closed SEGMK closed 1 month ago

SEGMK commented 1 month ago

Hi, I'm quite new to MAUI and DataBinding so if the answer to that is obvious I'm so sorry.

How can I Bind the ICommand method to the calendar such that after the user selects a date this binded method will be called and how can I pass the selected by user date as the argument to my ICommand method?

usefulBeeing commented 1 month ago

As described here, you could do something like this:

<controls:Calendar DayTappedCommand="{Binding DoSomethingCommand}">

In your ViewModel, you should inject a DateTime object into your Command or Method:

DoSomething(DateTime dateTime)