yurkinh / Plugin.Maui.Calendar

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

Question: Is there an easy way to get ShownDates (plural) from the calendar #53

Open InquisitorJax opened 3 months ago

InquisitorJax commented 3 months ago

Requirement: I'm binding events to data which is fetched from an api - so when month or week view is changed - or I change from week view to month view at runtime, I need to fetch new data based on the range of dates that are shown in the calendar. so

yurkinh commented 3 months ago

Hi @InquisitorJax 1) There is SelectedDates property. Check please RangeSelectionPage 2) ShowDate or PrevLayoutUnitCommand, NextLayoutUnitCommand, SwipeLeftCommand, SwipeRightCommand

InquisitorJax commented 3 months ago

I think perhaps you misunderstand slightly for example - if I'm viewing the calendar in month view of april, then would be handy to access a property like VisibleStartDate and VisibleEndDate - which would be Apr 1 - Apr 30. ie what are all the dates my user is looking at - so I know I need to fetch data for that date range. This is something different to date selection. So if there aren't properties like above to know this, I guess one can derive the visible dates from SelectedDate + CalendarLayout properties.

I guess ShownDate property change is also the best way to handle submitting a new query for the dates the user is seeing? So if the user does any user action that changes the visible dates (like via any of the commands above) - I need to submit a new query to fetch data for all the dates they can see.

yurkinh commented 2 months ago

Currently, there is no specific property for that hence if you can achieve results with ShownDate then use it. I will think about how to simplify this with next versions