1

I would like to have a page which includes 3 items:

  • A SwipeView: Horizontal swipe. We can swipe left and right to navigate to a next view. I think it is easy to achieve this one with ViewPager in Android (https://learn.microsoft.com/en-us/xamarin/android/user-interface/controls/view-pager/) and UIScrollView (pagingEnabled=YES) combined to UIPageControl (not sure where it is in Xamarin iOS). Look like there is no a UI control doing like this in Xamarin Form. I'm not sure.
  • A DatePicker: We can select a date, then SwipeView will load and show a content related to the selected date.
  • A Navigation: Include a previous navigation and next navigation, we can tap on these navigation to swipe to previous or next view. Behavior likes when we interact on SwipeView.

There is a big challenge here. By using SwipeView with Date navigation, we don't have a total dataset. We don't know number of views (pages) available!! Do you have any idea for solving this issue?

SwipeView with DatePicker Mock UI

Tony
  • 11
  • 3
  • Use collection view with one item a page with default [collection view](https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/collectionview/layout#horizontal-list) with a snap point and fake the back and forth navigation, or try [Sharpnado.HLV](https://github.com/roubachof/Sharpnado.HorizontalListView) – Shaw May 30 '21 at 09:09
  • Hi @shaw , Thanks for looking into this. What do you mean "fake the back and forth navigation"? Can you give a detail about it? As I described, the problem is that we don't know the total items of Collection. Theoretically, in my opinion, it will have un-limited items (indefinite) because each navigation (previous or next) will create a new item while a calendar has indefinite dates. User can next. next, next,... go so far. For example, user can navigate from Jan 01, 2021 to Jan 01, 2022 and more, the total of items will be greater than 365 items. How do you think? – Tony Jun 02 '21 at 15:09
  • Technically, collection view can support infinite list by lazy loading, e.g load three or five item in initialising and load the next one each time hit the navigation. And "fake the navigation" means it is not a real navigation, all happens in the same page inside the collection view, the "navigation" you mentioned is just the "SelectionChanged" event in CollectionView in my plan. – Shaw Jun 02 '21 at 20:38
  • Thank @Shaw for looking at this question so far. I solved it by keeping only 3 items in collection to detect if user swipes left or right, so we can navigate to previous date or next date. Each time the date changed by picker or swipe or clicking on the next/previous button, I will reload the collection with 3 other different items. It is not a best solution, but it currently work right now. The discussion is here https://learn.microsoft.com/en-us/answers/questions/414914/xamarin-form-ideadiscussion-about-making-a-swipevi.html – Tony Jun 18 '21 at 16:12

0 Answers0