├── .azure-devops ├── msbuild.sh ├── use-nuget.ps1 └── use-nuget.sh ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── custom.md │ └── feature_request.md └── workflows │ └── azure-devops-sync.yml ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── art ├── android-advanced.png ├── android-range.png ├── android-simple.png ├── iphone-advanced.png ├── iphone-range.png └── iphone-simple.png ├── azure-pipelines.yml └── src ├── Calendar.Plugin.Sample ├── SampleApp.Android │ ├── Assets │ │ ├── AboutAssets.txt │ │ ├── font-awesome-5-free-regular.otf │ │ └── font-awesome-5-free-solid.otf │ ├── MainActivity.cs │ ├── Properties │ │ ├── AndroidManifest.xml │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── AboutResources.txt │ │ ├── drawable-hdpi │ │ │ ├── baseline_calendar_today_black_24.png │ │ │ ├── baseline_date_range_black_24.png │ │ │ └── baseline_event_black_24.png │ │ ├── drawable-mdpi │ │ │ ├── baseline_calendar_today_black_24.png │ │ │ ├── baseline_date_range_black_24.png │ │ │ └── baseline_event_black_24.png │ │ ├── drawable-xhdpi │ │ │ ├── baseline_calendar_today_black_36.png │ │ │ ├── baseline_date_range_black_24.png │ │ │ └── baseline_event_black_24.png │ │ ├── drawable-xxhdpi │ │ │ ├── baseline_calendar_today_black_24.png │ │ │ ├── baseline_date_range_black_24.png │ │ │ └── baseline_event_black_24.png │ │ ├── drawable-xxxhdpi │ │ │ ├── baseline_calendar_today_black_24.png │ │ │ ├── baseline_date_range_black_24.png │ │ │ └── baseline_event_black_24.png │ │ ├── drawable │ │ │ ├── baseline_calendar_today_24.xml │ │ │ ├── baseline_date_range_24.xml │ │ │ └── baseline_event_24.xml │ │ ├── layout │ │ │ ├── Tabbar.axml │ │ │ └── Toolbar.axml │ │ ├── mipmap-anydpi-v26 │ │ │ ├── icon.xml │ │ │ └── icon_round.xml │ │ ├── mipmap-hdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ ├── mipmap-mdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ ├── mipmap-xhdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ ├── mipmap-xxhdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── icon.png │ │ │ └── launcher_foreground.png │ │ └── values │ │ │ ├── colors.xml │ │ │ └── styles.xml │ └── SampleApp.Android.csproj ├── SampleApp.iOS │ ├── AppDelegate.cs │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon1024.png │ │ │ ├── Icon120.png │ │ │ ├── Icon152.png │ │ │ ├── Icon167.png │ │ │ ├── Icon180.png │ │ │ ├── Icon20.png │ │ │ ├── Icon29.png │ │ │ ├── Icon40.png │ │ │ ├── Icon58.png │ │ │ ├── Icon60.png │ │ │ ├── Icon76.png │ │ │ ├── Icon80.png │ │ │ └── Icon87.png │ │ ├── baseline_calendar_today_black_24.imageset │ │ │ ├── Contents.json │ │ │ ├── baseline_calendar_today_black_24pt_1x.png │ │ │ ├── baseline_calendar_today_black_24pt_2x.png │ │ │ └── baseline_calendar_today_black_24pt_3x.png │ │ ├── baseline_date_range_black_24.imageset │ │ │ ├── Contents.json │ │ │ ├── baseline_date_range_black_24pt_1x.png │ │ │ ├── baseline_date_range_black_24pt_2x.png │ │ │ └── baseline_date_range_black_24pt_3x.png │ │ └── baseline_event_black_24.imageset │ │ │ ├── Contents.json │ │ │ ├── baseline_event_black_24pt_1x.png │ │ │ ├── baseline_event_black_24pt_2x.png │ │ │ └── baseline_event_black_24pt_3x.png │ ├── Entitlements.plist │ ├── Info.plist │ ├── Main.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Default-568h@2x.png │ │ ├── Default-Portrait.png │ │ ├── Default-Portrait@2x.png │ │ ├── Default.png │ │ ├── Default@2x.png │ │ ├── LaunchScreen.storyboard │ │ ├── font-awesome-5-free-regular.otf │ │ └── font-awesome-5-free-solid.otf │ └── SampleApp.iOS.csproj └── SampleApp │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── Controls │ ├── CalendarFooter.xaml │ ├── CalendarFooter.xaml.cs │ ├── CalendarHeader.xaml │ ├── CalendarHeader.xaml.cs │ ├── CalenderEvent.xaml │ └── CalenderEvent.xaml.cs │ ├── Model │ ├── AdvancedEventModel.cs │ ├── CalendarPickerResult.cs │ ├── CalendarRangePickerResult.cs │ ├── DayEventCollection.cs │ └── EventModel.cs │ ├── SampleApp.csproj │ ├── ViewModels │ ├── AdvancedPageViewModel.cs │ ├── BasePageViewModel.cs │ ├── CalendarPickerPopupViewModel.cs │ ├── CalendarRangePickerPopupSelectedDatesViewModel.cs │ ├── CalendarRangePickerPopupViewModel.cs │ ├── RangeSelectionPageViewModel.cs │ ├── SimplePageViewModel.cs │ ├── TwoWeekViewPageViewModel.cs │ └── WeekViewPageViewModel.cs │ └── Views │ ├── AdvancedPage.xaml │ ├── AdvancedPage.xaml.cs │ ├── CalendarPickerPopup.xaml │ ├── CalendarPickerPopup.xaml.cs │ ├── CalendarRangePickerPopup.xaml │ ├── CalendarRangePickerPopup.xaml.cs │ ├── CalendarRangePickerPopupSelectedDates.xaml │ ├── CalendarRangePickerPopupSelectedDates.xaml.cs │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── RangeSelectionPage.xaml │ ├── RangeSelectionPage.xaml.cs │ ├── SimplePage.xaml │ ├── SimplePage.xaml.cs │ ├── TwoWeekViewPage.xaml │ ├── TwoWeekViewPage.xaml.cs │ ├── WeekViewPage.xaml │ └── WeekViewPage.xaml.cs ├── Calendar.Plugin.sln └── Calendar.Plugin ├── Android └── SwipeAwareContainerRenderer.cs ├── CalendarPlugin.csproj ├── Shared ├── Controls │ ├── Calendar.xaml │ ├── Calendar.xaml.cs │ ├── DataTemplateView.cs │ ├── DayView.xaml │ ├── DayView.xaml.cs │ ├── DefaultFooterSection.xaml │ ├── DefaultFooterSection.xaml.cs │ ├── DefaultHeaderSection.xaml │ ├── DefaultHeaderSection.xaml.cs │ ├── GenericRepeaterView.cs │ ├── MonthDaysView.cs │ ├── RangeSelectionCalendar.cs │ ├── SelectionEngines │ │ ├── RangeSelectionEngine.cs │ │ └── SingleSelectionEngine.cs │ ├── SwipeAwareContainer.cs │ └── ViewLayoutEngines │ │ ├── MonthViewEngine.cs │ │ ├── ViewLayoutBase.cs │ │ └── WeekViewEngine.cs ├── Enums │ ├── DaysTitleMaxLength.cs │ ├── EventIndicatorType.cs │ ├── WeekLayout.cs │ └── WeekViewUnit.cs ├── Extensions.cs ├── Interfaces │ ├── IPersonalizableDayEvent.cs │ ├── ISelectionEngine.cs │ └── IViewLayoutEngine.cs └── Models │ ├── BindableBase.cs │ ├── DayModel.cs │ └── EventCollection.cs └── iOS └── SwipeAwareContainerRenderer.cs /.azure-devops/msbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo $MONO_OPTIONS 3 | echo $@ 4 | mono '/Applications/Visual Studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/msbuild.dll' "$@" -------------------------------------------------------------------------------- /.azure-devops/use-nuget.ps1: -------------------------------------------------------------------------------- 1 | $nugetVersion = $Env:NUGETVERSION 2 | echo "Nuget Version = "$nugetVersion 3 | 4 | ((Get-Content src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj) -replace 'CalendarPlugin'} | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj 8 | (Get-Content src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj -Raw) -replace "(?sm).*?", "" | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj 9 | 10 | # (Get-Content src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj) | Where-Object {$_ -notmatch '81e938f4-a11c-4726-a13f-0d7ecc84ca66'} | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj 11 | # (Get-Content src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj) | Where-Object {$_ -notmatch 'CalendarPlugin'} | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj 12 | (Get-Content src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj -Raw) -replace "(?sm).*?", "" | Out-File -encoding ASCII src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj 13 | -------------------------------------------------------------------------------- /.azure-devops/use-nuget.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Nuget Version = "$NUGETVERSION 4 | 5 | sed -E -i .bak -e 's/CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj 9 | sed -E -i .bak -e '//{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj 10 | sed -E -i .bak -e 's///g' src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj 11 | 12 | sed -i .bak -e '/81e938f4-a11c-4726-a13f-0d7ecc84ca66/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj 13 | sed -i .bak -e '/CalendarPlugin/d' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj 14 | sed -E -i .bak -e '//{N;s/\n.*//;}' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj 15 | sed -E -i .bak -e 's///g' src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj 16 | 17 | ## Debug 18 | #cat src/Calendar.Plugin.Sample/SampleApp.Android/SampleApp.Android.csproj 19 | #cat src/Calendar.Plugin.Sample/SampleApp.iOS/SampleApp.iOS.csproj -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[Bug] Bug title" 5 | labels: bug 6 | assignees: PenguinPero 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Version information:** 27 | - Plugin version: ? 28 | - Xamarin.Forms version: ? 29 | - Platform: ? 30 | 31 | **Additional context** 32 | Add any other context about the problem here. 33 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: If you have any questions about usage use this template. 4 | title: "[Custom] Your title" 5 | labels: help wanted 6 | assignees: PenguinPero 7 | 8 | --- 9 | 10 | 7 | 26 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace SampleApp.iOS 9 | { 10 | // The UIApplicationDelegate for the application. This class is responsible for launching the 11 | // User Interface of the application, as well as listening (and optionally responding) to 12 | // application events from iOS. 13 | [Register("AppDelegate")] 14 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 15 | { 16 | // 17 | // This method is invoked when the application has loaded and is ready to run. In this 18 | // method you should instantiate the window, load the UI into it and then make the window 19 | // visible. 20 | // 21 | // You have 17 seconds to return from this method, or iOS will terminate your application. 22 | // 23 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 24 | { 25 | Rg.Plugins.Popup.Popup.Init(); 26 | 27 | global::Xamarin.Forms.Forms.Init(); 28 | LoadApplication(new App()); 29 | 30 | return base.FinishedLaunching(app, options); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "scale": "2x", 5 | "size": "20x20", 6 | "idiom": "iphone", 7 | "filename": "Icon40.png" 8 | }, 9 | { 10 | "scale": "3x", 11 | "size": "20x20", 12 | "idiom": "iphone", 13 | "filename": "Icon60.png" 14 | }, 15 | { 16 | "scale": "2x", 17 | "size": "29x29", 18 | "idiom": "iphone", 19 | "filename": "Icon58.png" 20 | }, 21 | { 22 | "scale": "3x", 23 | "size": "29x29", 24 | "idiom": "iphone", 25 | "filename": "Icon87.png" 26 | }, 27 | { 28 | "scale": "2x", 29 | "size": "40x40", 30 | "idiom": "iphone", 31 | "filename": "Icon80.png" 32 | }, 33 | { 34 | "scale": "3x", 35 | "size": "40x40", 36 | "idiom": "iphone", 37 | "filename": "Icon120.png" 38 | }, 39 | { 40 | "scale": "2x", 41 | "size": "60x60", 42 | "idiom": "iphone", 43 | "filename": "Icon120.png" 44 | }, 45 | { 46 | "scale": "3x", 47 | "size": "60x60", 48 | "idiom": "iphone", 49 | "filename": "Icon180.png" 50 | }, 51 | { 52 | "scale": "1x", 53 | "size": "20x20", 54 | "idiom": "ipad", 55 | "filename": "Icon20.png" 56 | }, 57 | { 58 | "scale": "2x", 59 | "size": "20x20", 60 | "idiom": "ipad", 61 | "filename": "Icon40.png" 62 | }, 63 | { 64 | "scale": "1x", 65 | "size": "29x29", 66 | "idiom": "ipad", 67 | "filename": "Icon29.png" 68 | }, 69 | { 70 | "scale": "2x", 71 | "size": "29x29", 72 | "idiom": "ipad", 73 | "filename": "Icon58.png" 74 | }, 75 | { 76 | "scale": "1x", 77 | "size": "40x40", 78 | "idiom": "ipad", 79 | "filename": "Icon40.png" 80 | }, 81 | { 82 | "scale": "2x", 83 | "size": "40x40", 84 | "idiom": "ipad", 85 | "filename": "Icon80.png" 86 | }, 87 | { 88 | "scale": "1x", 89 | "size": "76x76", 90 | "idiom": "ipad", 91 | "filename": "Icon76.png" 92 | }, 93 | { 94 | "scale": "2x", 95 | "size": "76x76", 96 | "idiom": "ipad", 97 | "filename": "Icon152.png" 98 | }, 99 | { 100 | "scale": "2x", 101 | "size": "83.5x83.5", 102 | "idiom": "ipad", 103 | "filename": "Icon167.png" 104 | }, 105 | { 106 | "scale": "1x", 107 | "size": "1024x1024", 108 | "idiom": "ios-marketing", 109 | "filename": "Icon1024.png" 110 | } 111 | ], 112 | "properties": {}, 113 | "info": { 114 | "version": 1, 115 | "author": "xcode" 116 | } 117 | } -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_calendar_today_black_24.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "appearances": [], 5 | "scale": "1x", 6 | "idiom": "universal", 7 | "filename": "baseline_calendar_today_black_24pt_1x.png" 8 | }, 9 | { 10 | "appearances": [], 11 | "scale": "2x", 12 | "idiom": "universal", 13 | "filename": "baseline_calendar_today_black_24pt_2x.png" 14 | }, 15 | { 16 | "appearances": [], 17 | "scale": "3x", 18 | "idiom": "universal", 19 | "filename": "baseline_calendar_today_black_24pt_3x.png" 20 | } 21 | ], 22 | "properties": {}, 23 | "info": { 24 | "version": 1, 25 | "author": "xcode", 26 | "template-rendering-intent": "template" 27 | } 28 | } -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_calendar_today_black_24.imageset/baseline_calendar_today_black_24pt_1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_calendar_today_black_24.imageset/baseline_calendar_today_black_24pt_1x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_calendar_today_black_24.imageset/baseline_calendar_today_black_24pt_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_calendar_today_black_24.imageset/baseline_calendar_today_black_24pt_2x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_calendar_today_black_24.imageset/baseline_calendar_today_black_24pt_3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_calendar_today_black_24.imageset/baseline_calendar_today_black_24pt_3x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_date_range_black_24.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "appearances": [], 5 | "scale": "1x", 6 | "idiom": "universal", 7 | "filename": "baseline_date_range_black_24pt_1x.png" 8 | }, 9 | { 10 | "appearances": [], 11 | "scale": "2x", 12 | "idiom": "universal", 13 | "filename": "baseline_date_range_black_24pt_2x.png" 14 | }, 15 | { 16 | "appearances": [], 17 | "scale": "3x", 18 | "idiom": "universal", 19 | "filename": "baseline_date_range_black_24pt_3x.png" 20 | } 21 | ], 22 | "properties": {}, 23 | "info": { 24 | "version": 1, 25 | "author": "xcode", 26 | "template-rendering-intent": "template" 27 | } 28 | } -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_date_range_black_24.imageset/baseline_date_range_black_24pt_1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_date_range_black_24.imageset/baseline_date_range_black_24pt_1x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_date_range_black_24.imageset/baseline_date_range_black_24pt_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_date_range_black_24.imageset/baseline_date_range_black_24pt_2x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_date_range_black_24.imageset/baseline_date_range_black_24pt_3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_date_range_black_24.imageset/baseline_date_range_black_24pt_3x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_event_black_24.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "appearances": [], 5 | "scale": "1x", 6 | "idiom": "universal", 7 | "filename": "baseline_event_black_24pt_1x.png" 8 | }, 9 | { 10 | "appearances": [], 11 | "scale": "2x", 12 | "idiom": "universal", 13 | "filename": "baseline_event_black_24pt_2x.png" 14 | }, 15 | { 16 | "appearances": [], 17 | "scale": "3x", 18 | "idiom": "universal", 19 | "filename": "baseline_event_black_24pt_3x.png" 20 | } 21 | ], 22 | "properties": {}, 23 | "info": { 24 | "version": 1, 25 | "author": "xcode", 26 | "template-rendering-intent": "template" 27 | } 28 | } -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_event_black_24.imageset/baseline_event_black_24pt_1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_event_black_24.imageset/baseline_event_black_24pt_1x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_event_black_24.imageset/baseline_event_black_24pt_2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_event_black_24.imageset/baseline_event_black_24pt_2x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_event_black_24.imageset/baseline_event_black_24pt_3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Assets.xcassets/baseline_event_black_24.imageset/baseline_event_black_24pt_3x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UISupportedInterfaceOrientations 11 | 12 | UIInterfaceOrientationPortrait 13 | UIInterfaceOrientationLandscapeLeft 14 | UIInterfaceOrientationLandscapeRight 15 | 16 | UISupportedInterfaceOrientations~ipad 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationPortraitUpsideDown 20 | UIInterfaceOrientationLandscapeLeft 21 | UIInterfaceOrientationLandscapeRight 22 | 23 | MinimumOSVersion 24 | 8.0 25 | CFBundleDisplayName 26 | Calendar sample 27 | CFBundleIdentifier 28 | com.calendarsample.app 29 | CFBundleVersion 30 | 1.0 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | CFBundleName 34 | SampleApp 35 | XSAppIconAssets 36 | Assets.xcassets/AppIcon.appiconset 37 | UIAppFonts 38 | 39 | font-awesome-5-free-regular.otf 40 | font-awesome-5-free-solid.otf 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace SampleApp.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, "AppDelegate"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SampleApp.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("SampleApp.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/font-awesome-5-free-regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/font-awesome-5-free-regular.otf -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/font-awesome-5-free-solid.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lilcodelab/Xamarin.Plugin.Calendar/0e5794b387577cb55883d8015a2632e964bff15e/src/Calendar.Plugin.Sample/SampleApp.iOS/Resources/font-awesome-5-free-solid.otf -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/App.xaml: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using SampleApp.Views; 2 | using Xamarin.Forms; 3 | 4 | namespace SampleApp 5 | { 6 | public partial class App : Application 7 | { 8 | public static new App Current => (App)Application.Current; 9 | 10 | public App() 11 | { 12 | InitializeComponent(); 13 | 14 | MainPage = new NavigationPage(new MainPage()); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms.Xaml; 2 | 3 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Controls/CalendarFooter.xaml: -------------------------------------------------------------------------------- 1 |  2 | 6 | 10 | 11 | 12 | 13 | 14 | 49 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Controls/CalendarFooter.xaml.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | using Xamarin.Forms.Xaml; 3 | 4 | namespace SampleApp.Controls 5 | { 6 | [XamlCompilation(XamlCompilationOptions.Compile)] 7 | public partial class CalendarFooter : ContentView 8 | { 9 | public CalendarFooter() 10 | { 11 | InitializeComponent(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Controls/CalendarHeader.xaml: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 33 | 94 | 95 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Controls/CalendarHeader.xaml.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | using Xamarin.Forms.Xaml; 3 | 4 | namespace SampleApp.Controls 5 | { 6 | [XamlCompilation(XamlCompilationOptions.Compile)] 7 | public partial class CalendarHeader : DataTemplate 8 | { 9 | public CalendarHeader() 10 | { 11 | InitializeComponent(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Controls/CalenderEvent.xaml: -------------------------------------------------------------------------------- 1 |  2 | 8 | 12 | 21 | 29 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Controls/CalenderEvent.xaml.cs: -------------------------------------------------------------------------------- 1 | using SampleApp.Model; 2 | using System.Windows.Input; 3 | using Xamarin.Forms; 4 | using Xamarin.Forms.Xaml; 5 | 6 | namespace SampleApp.Controls 7 | { 8 | [XamlCompilation(XamlCompilationOptions.Compile)] 9 | public partial class CalenderEvent : ContentView 10 | { 11 | public static BindableProperty CalenderEventCommandProperty = 12 | BindableProperty.Create(nameof(CalenderEventCommand), typeof(ICommand), typeof(CalenderEvent), null); 13 | 14 | public CalenderEvent() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | public ICommand CalenderEventCommand 20 | { 21 | get => (ICommand)GetValue(CalenderEventCommandProperty); 22 | set => SetValue(CalenderEventCommandProperty, value); 23 | } 24 | 25 | private void TapGestureRecognizer_Tapped(object sender, System.EventArgs e) 26 | { 27 | if (BindingContext is AdvancedEventModel eventModel) 28 | CalenderEventCommand?.Execute(eventModel); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Model/AdvancedEventModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SampleApp.Model 4 | { 5 | public class AdvancedEventModel 6 | { 7 | public string Name { get; set; } 8 | public string Description { get; set; } 9 | public DateTime Starting { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Model/CalendarPickerResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace SampleApp.Model 4 | { 5 | public class CalendarPickerResult 6 | { 7 | public bool IsSuccess { get; set; } 8 | 9 | public DateTime? SelectedDate { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Model/CalendarRangePickerResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SampleApp.Model 5 | { 6 | public class CalendarRangePickerResult 7 | { 8 | public bool IsSuccess { get; set; } 9 | public List SelectedDates { get; set; } = new List(); 10 | public DateTime? SelectedStartDate { get; set; } 11 | public DateTime? SelectedEndDate { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Model/DayEventCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Xamarin.Forms; 3 | using Xamarin.Plugin.Calendar.Interfaces; 4 | 5 | namespace SampleApp.Model 6 | { 7 | /// 8 | /// Wrapper to allow change the dot color 9 | /// 10 | public class DayEventCollection : List, IPersonalizableDayEvent 11 | { 12 | /// 13 | /// Empty contructor extends from base() 14 | /// 15 | public DayEventCollection() : base() 16 | { } 17 | 18 | /// 19 | /// Color contructor extends from base() 20 | /// 21 | /// 22 | /// 23 | public DayEventCollection(Color? eventIndicatorColor, Color? eventIndicatorSelectedColor) : base() 24 | { 25 | EventIndicatorColor = eventIndicatorColor; 26 | EventIndicatorSelectedColor = eventIndicatorSelectedColor; 27 | } 28 | 29 | /// 30 | /// IEnumerable contructor extends from base(IEnumerable collection) 31 | /// 32 | /// 33 | public DayEventCollection(IEnumerable collection) : base(collection) 34 | { } 35 | 36 | /// 37 | /// Capacity contructor extends from base(int capacity) 38 | /// 39 | /// 40 | public DayEventCollection(int capacity) : base(capacity) 41 | { } 42 | 43 | #region PersonalizableProperties 44 | public Color? EventIndicatorColor { get; set; } 45 | public Color? EventIndicatorSelectedColor { get; set; } 46 | public Color? EventIndicatorTextColor { get; set; } 47 | public Color? EventIndicatorSelectedTextColor { get; set; } 48 | 49 | #endregion 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Model/EventModel.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace SampleApp.Model 3 | { 4 | public class EventModel 5 | { 6 | public string Name { get; set; } 7 | public string Description { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/SampleApp.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.1 5 | true 6 | latest 7 | 8 | 9 | 10 | portable 11 | true 12 | DEBUG;TRACE 13 | 14 | 15 | 16 | none 17 | false 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | RangeSelectionPage.xaml 32 | 33 | 34 | 35 | 36 | 37 | MSBuild:UpdateDesignTimeXaml 38 | 39 | 40 | MSBuild:UpdateDesignTimeXaml 41 | 42 | 43 | MSBuild:UpdateDesignTimeXaml 44 | 45 | 46 | MSBuild:UpdateDesignTimeXaml 47 | 48 | 49 | MSBuild:UpdateDesignTimeXaml 50 | 51 | 52 | MSBuild:UpdateDesignTimeXaml 53 | 54 | 55 | MSBuild:UpdateDesignTimeXaml 56 | 57 | 58 | MSBuild:UpdateDesignTimeXaml 59 | 60 | 61 | MSBuild:UpdateDesignTimeXaml 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/ViewModels/BasePageViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Runtime.CompilerServices; 3 | 4 | namespace SampleApp.ViewModels 5 | { 6 | public class BasePageViewModel : INotifyPropertyChanged 7 | { 8 | public BasePageViewModel() 9 | { } 10 | 11 | #region INotifyPropertyChanged 12 | 13 | public event PropertyChangedEventHandler PropertyChanged; 14 | 15 | protected void SetProperty(ref TData storage, TData value, [CallerMemberName] string propertyName = "") 16 | { 17 | if (storage?.Equals(value) == true) 18 | return; 19 | 20 | storage = value; 21 | 22 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 23 | } 24 | 25 | #endregion 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/ViewModels/CalendarPickerPopupViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rg.Plugins.Popup.Services; 2 | using SampleApp.Model; 3 | using System; 4 | using System.Windows.Input; 5 | using Xamarin.Forms; 6 | using Xamarin.Plugin.Calendar.Enums; 7 | 8 | namespace SampleApp.ViewModels 9 | { 10 | public class CalendarPickerPopupViewModel : BasePageViewModel 11 | { 12 | public event Action Closed; 13 | 14 | public CalendarPickerPopupViewModel() : base() 15 | { 16 | SelectedDate = new DateTime(2021, 6, 13); 17 | } 18 | 19 | public ICommand ClearCommand => new Command(() => 20 | { 21 | SelectedDate = null; 22 | }); 23 | 24 | public ICommand SuccessCommand => new Command(async () => 25 | { 26 | Closed?.Invoke(new CalendarPickerResult() { IsSuccess = SelectedDate.HasValue, SelectedDate = SelectedDate }); 27 | 28 | await PopupNavigation.Instance.PopAsync(); 29 | }); 30 | 31 | public ICommand CancelCommand => new Command(async () => 32 | { 33 | Closed?.Invoke(new CalendarPickerResult() { IsSuccess = false }); 34 | await PopupNavigation.Instance.PopAsync(); 35 | }); 36 | 37 | private DateTime _shownDate = DateTime.Today; 38 | 39 | public DateTime ShownDate 40 | { 41 | get => _shownDate; 42 | set => SetProperty(ref _shownDate, value); 43 | } 44 | 45 | private WeekLayout _calendarLayout = WeekLayout.Month; 46 | 47 | public WeekLayout CalendarLayout 48 | { 49 | get => _calendarLayout; 50 | set => SetProperty(ref _calendarLayout, value); 51 | } 52 | 53 | private DateTime? _selectedDate; 54 | 55 | public DateTime? SelectedDate 56 | { 57 | get => _selectedDate; 58 | set => SetProperty(ref _selectedDate, value); 59 | } 60 | 61 | private DateTime _minimumDate = new DateTime(1900, 1, 1); 62 | 63 | public DateTime MinimumDate 64 | { 65 | get => _minimumDate; 66 | set => SetProperty(ref _minimumDate, value); 67 | } 68 | 69 | private DateTime _maximumDate = DateTime.Today; 70 | 71 | public DateTime MaximumDate 72 | { 73 | get => _maximumDate; 74 | set => SetProperty(ref _maximumDate, value); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/ViewModels/CalendarRangePickerPopupSelectedDatesViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rg.Plugins.Popup.Services; 2 | using SampleApp.Model; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Windows.Input; 6 | using Xamarin.Forms; 7 | using Xamarin.Plugin.Calendar.Enums; 8 | 9 | namespace SampleApp.ViewModels 10 | { 11 | public class CalendarRangePickerPopupSelectedDatesViewModel : BasePageViewModel 12 | { 13 | private DateTime _maximumDate = DateTime.Today.AddYears(1); 14 | 15 | private DateTime _minimumDate = DateTime.Today.AddYears(-1); 16 | 17 | private DateTime _shownDate = DateTime.Today; 18 | 19 | private List _selectedDates = null; 20 | 21 | private WeekLayout _calendarLayout = WeekLayout.Month; 22 | 23 | public CalendarRangePickerPopupSelectedDatesViewModel() 24 | { 25 | SelectedDates = new List 26 | { 27 | DateTime.Today, 28 | DateTime.Today.AddDays(6), 29 | }; 30 | } 31 | 32 | public event Action Closed; 33 | 34 | public ICommand CancelCommand => new Command(async () => 35 | { 36 | Closed?.Invoke(new CalendarRangePickerResult() { IsSuccess = false }); 37 | await PopupNavigation.Instance.PopAsync(); 38 | }); 39 | 40 | public ICommand ClearCommand => new Command(() => 41 | { 42 | SelectedDates = null; 43 | }); 44 | 45 | public DateTime MaximumDate 46 | { 47 | get => _maximumDate; 48 | set => SetProperty(ref _maximumDate, value); 49 | } 50 | 51 | public DateTime MinimumDate 52 | { 53 | get => _minimumDate; 54 | set => SetProperty(ref _minimumDate, value); 55 | } 56 | 57 | public DateTime ShownDate 58 | { 59 | get => _shownDate; 60 | set => SetProperty(ref _shownDate, value); 61 | } 62 | 63 | public WeekLayout CalendarLayout 64 | { 65 | get => _calendarLayout; 66 | set => SetProperty(ref _calendarLayout, value); 67 | } 68 | 69 | public List SelectedDates 70 | { 71 | get => _selectedDates; 72 | set => SetProperty(ref _selectedDates, value); 73 | } 74 | 75 | public ICommand SuccessCommand => new Command(async () => 76 | { 77 | Closed?.Invoke(new CalendarRangePickerResult() 78 | { 79 | IsSuccess = true, 80 | SelectedDates = SelectedDates 81 | }); 82 | await PopupNavigation.Instance.PopAsync(); 83 | }); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/ViewModels/CalendarRangePickerPopupViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rg.Plugins.Popup.Services; 2 | using SampleApp.Model; 3 | using System; 4 | using System.Windows.Input; 5 | using Xamarin.Forms; 6 | using Xamarin.Plugin.Calendar.Enums; 7 | 8 | namespace SampleApp.ViewModels 9 | { 10 | public class CalendarRangePickerPopupViewModel : BasePageViewModel 11 | { 12 | private DateTime _maximumDate = DateTime.Today.AddYears(1); 13 | 14 | private DateTime _minimumDate = DateTime.Today.AddYears(-1); 15 | 16 | private DateTime _shownDate = DateTime.Today; 17 | 18 | private WeekLayout _calendarLayout = WeekLayout.Month; 19 | 20 | private DateTime? _selectedStartDate = DateTime.Today.AddDays(-5); 21 | private DateTime? _selectedEndDate = DateTime.Today.AddDays(5); 22 | 23 | public event Action Closed; 24 | 25 | public ICommand CancelCommand => new Command(async () => 26 | { 27 | Closed?.Invoke(new CalendarRangePickerResult() { IsSuccess = false }); 28 | await PopupNavigation.Instance.PopAsync(); 29 | }); 30 | 31 | public ICommand ClearCommand => new Command(() => 32 | { 33 | SelectedEndDate = null; 34 | SelectedStartDate = null; 35 | }); 36 | 37 | public DateTime MaximumDate 38 | { 39 | get => _maximumDate; 40 | set => SetProperty(ref _maximumDate, value); 41 | } 42 | 43 | public DateTime MinimumDate 44 | { 45 | get => _minimumDate; 46 | set => SetProperty(ref _minimumDate, value); 47 | } 48 | 49 | public DateTime ShownDate 50 | { 51 | get => _shownDate; 52 | set => SetProperty(ref _shownDate, value); 53 | } 54 | 55 | public WeekLayout CalendarLayout 56 | { 57 | get => _calendarLayout; 58 | set => SetProperty(ref _calendarLayout, value); 59 | } 60 | 61 | public DateTime? SelectedStartDate 62 | { 63 | get => _selectedStartDate; 64 | set => SetProperty(ref _selectedStartDate, value); 65 | } 66 | 67 | public DateTime? SelectedEndDate 68 | { 69 | get => _selectedEndDate; 70 | set => SetProperty(ref _selectedEndDate, value); 71 | } 72 | 73 | public ICommand SuccessCommand => new Command(async () => 74 | { 75 | Closed?.Invoke(new CalendarRangePickerResult() 76 | { 77 | IsSuccess = true, 78 | SelectedStartDate = SelectedStartDate, 79 | SelectedEndDate = SelectedEndDate 80 | }); 81 | await PopupNavigation.Instance.PopAsync(); 82 | }); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/ViewModels/RangeSelectionPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using SampleApp.Model; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | using Xamarin.Forms; 8 | using Xamarin.Plugin.Calendar.Enums; 9 | using Xamarin.Plugin.Calendar.Models; 10 | 11 | namespace SampleApp.ViewModels 12 | { 13 | public class RangeSelectionPageViewModel : BasePageViewModel 14 | { 15 | private DateTime? _selectedEndDate = DateTime.Today.AddDays(2); 16 | 17 | private DateTime _shownDate = DateTime.Today; 18 | 19 | private WeekLayout _calendarLayout = WeekLayout.Month; 20 | 21 | private List _selectedDates = new(); 22 | 23 | private DateTime? _selectedStartDate = DateTime.Today.AddDays(-9); 24 | 25 | public RangeSelectionPageViewModel() : base() 26 | { 27 | // testing all kinds of adding events 28 | // when initializing collection 29 | Events = new EventCollection 30 | { 31 | [DateTime.Now.AddDays(-1)] = new List(GenerateEvents(5, "Cool", DateTime.Now.AddDays(-1))), 32 | [DateTime.Now.AddDays(-2)] = new DayEventCollection(GenerateEvents(10, "Cool", DateTime.Now.AddDays(-2))), 33 | [DateTime.Now.AddDays(-4)] = new DayEventCollection(GenerateEvents(10, "Super Cool", DateTime.Now.AddDays(-4))), 34 | [DateTime.Now.AddDays(-5)] = new DayEventCollection(GenerateEvents(10, "Cool", DateTime.Now.AddDays(-5))), 35 | [DateTime.Now.AddDays(-6)] = new DayEventCollection(Color.Purple, Color.Purple) 36 | { 37 | new AdvancedEventModel { Name = "Cool event1", Description = "This is Cool event1's description!", Starting= DateTime.Now.AddDays(-6)}, 38 | new AdvancedEventModel { Name = "Cool event2", Description = "This is Cool event2's description!", Starting= DateTime.Now.AddDays(-6)} 39 | }, 40 | [DateTime.Now.AddDays(-10)] = new List(GenerateEvents(10, "Cool", DateTime.Now.AddDays(-10))), 41 | [DateTime.Now.AddDays(1)] = new List(GenerateEvents(2, "Boring", DateTime.Now.AddDays(1))), 42 | [DateTime.Now.AddDays(4)] = new List(GenerateEvents(10, "Cool", DateTime.Now.AddDays(4))), 43 | [DateTime.Now.AddDays(8)] = new List(GenerateEvents(1, "Cool", DateTime.Now.AddDays(8))), 44 | [DateTime.Now.AddDays(9)] = new List(GenerateEvents(10, "Cool H", DateTime.Now.AddDays(9))), 45 | [DateTime.Now.AddDays(10)] = new List(GenerateEvents(100, "Cool X", DateTime.Now.AddDays(10))), 46 | [DateTime.Now.AddDays(16)] = new List(GenerateEvents(7, "Cool B", DateTime.Now.AddDays(16))), 47 | [DateTime.Now.AddDays(20)] = new List(GenerateEvents(9, "Cool A", DateTime.Now.AddDays(20))), 48 | [DateTime.Now.AddDays(35)] = new List(GenerateEvents(1, "Cool S", DateTime.Now.AddDays(35))), 49 | [DateTime.Now.AddDays(43)] = new List(GenerateEvents(4, "Cool Q", DateTime.Now.AddDays(43))), 50 | [DateTime.Now.AddDays(46)] = new List(GenerateEvents(12, "Cool ZZ", DateTime.Now.AddDays(46))), 51 | [DateTime.Now.AddDays(51)] = new List(GenerateEvents(3, "Cool Y", DateTime.Now.AddDays(51))), 52 | }; 53 | 54 | ShownDate = ShownDate.AddMonths(1); 55 | } 56 | 57 | public EventCollection Events { get; } 58 | 59 | public ICommand EventSelectedCommand => new Command(async (item) => await ExecuteEventSelectedCommand(item)); 60 | 61 | public DateTime ShownDate 62 | { 63 | get => _shownDate; 64 | set => SetProperty(ref _shownDate, value); 65 | } 66 | 67 | public WeekLayout CalendarLayout 68 | { 69 | get => _calendarLayout; 70 | set => SetProperty(ref _calendarLayout, value); 71 | } 72 | 73 | public List SelectedDates 74 | { 75 | get => _selectedDates; 76 | set => SetProperty(ref _selectedDates, value); 77 | } 78 | 79 | public DateTime? SelectedStartDate 80 | { 81 | get => _selectedStartDate; 82 | set => SetProperty(ref _selectedStartDate, value); 83 | } 84 | 85 | public DateTime? SelectedEndDate 86 | { 87 | get => _selectedEndDate; 88 | set => SetProperty(ref _selectedEndDate, value); 89 | } 90 | 91 | private async Task ExecuteEventSelectedCommand(object item) 92 | { 93 | if (item is AdvancedEventModel eventModel) 94 | { 95 | var title = $"Selected: {eventModel.Name}"; 96 | var message = $"Starts: {eventModel.Starting:HH:mm}{Environment.NewLine}Details: {eventModel.Description}"; 97 | await App.Current.MainPage.DisplayAlert(title, message, "Ok"); 98 | } 99 | } 100 | 101 | private IEnumerable GenerateEvents(int count, string name, DateTime timeOfEvent) 102 | { 103 | return Enumerable.Range(1, count).Select(x => new AdvancedEventModel 104 | { 105 | Name = $"{name} event{x}", 106 | Description = $"This is {name} event{x}'s description!", 107 | Starting = new DateTime(timeOfEvent.Year, timeOfEvent.Month, timeOfEvent.Day, (x * 2) % 24, (x * 3) % 60, 0) 108 | }); 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/ViewModels/SimplePageViewModel.cs: -------------------------------------------------------------------------------- 1 | using SampleApp.Model; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows.Input; 8 | using Xamarin.Forms; 9 | using Xamarin.Plugin.Calendar.Models; 10 | 11 | namespace SampleApp.ViewModels 12 | { 13 | public class SimplePageViewModel : BasePageViewModel 14 | { 15 | public ICommand TodayCommand => new Command(() => 16 | { 17 | Year = DateTime.Today.Year; 18 | Month = DateTime.Today.Month; 19 | }); 20 | 21 | public ICommand EventSelectedCommand => new Command(async (item) => await ExecuteEventSelectedCommand(item)); 22 | 23 | public SimplePageViewModel() : base() 24 | { 25 | Device.BeginInvokeOnMainThread(async () => await App.Current.MainPage.DisplayAlert("Info", "Loading events with delay, and changeing current view.", "Ok")); 26 | 27 | // testing all kinds of adding events 28 | // when initializing collection 29 | Events = new EventCollection 30 | { 31 | [DateTime.Now.AddDays(-3)] = new List(GenerateEvents(10, "Cool")), 32 | [DateTime.Now.AddDays(4)] = new List(GenerateEvents(2, "Simple2")), 33 | [DateTime.Now.AddDays(2)] = new List(GenerateEvents(1, "Simple1")), 34 | [DateTime.Now.AddDays(1)] = new List(GenerateEvents(3, "Simple3")), 35 | }; 36 | 37 | // with add method 38 | Events.Add(DateTime.Now.AddDays(-1), new List(GenerateEvents(5, "Cool"))); 39 | 40 | // with indexer 41 | Events[DateTime.Now] = new List(GenerateEvents(2, "Boring")); 42 | 43 | Task.Delay(5000).ContinueWith(_ => 44 | { 45 | // indexer - update later 46 | Events[DateTime.Now] = new ObservableCollection(GenerateEvents(10, "Cool")); 47 | 48 | // add later 49 | Events.Add(DateTime.Now.AddDays(3), new List(GenerateEvents(5, "Cool"))); 50 | 51 | // indexer later 52 | Events[DateTime.Now.AddDays(10)] = new List(GenerateEvents(10, "Boring")); 53 | 54 | // add later 55 | Events.Add(DateTime.Now.AddDays(15), new List(GenerateEvents(10, "Cool"))); 56 | 57 | Month += 1; 58 | 59 | Task.Delay(3000).ContinueWith(t => 60 | { 61 | // get observable collection later 62 | var todayEvents = Events[DateTime.Now] as ObservableCollection; 63 | 64 | // insert/add items to observable collection 65 | todayEvents.Insert(0, new EventModel { Name = "Cool event insert", Description = "This is Cool event's description!" }); 66 | todayEvents.Add(new EventModel { Name = "Cool event add", Description = "This is Cool event's description!" }); 67 | 68 | Month += 1; 69 | }, TaskScheduler.FromCurrentSynchronizationContext()); 70 | }, TaskScheduler.FromCurrentSynchronizationContext()); 71 | } 72 | 73 | private IEnumerable GenerateEvents(int count, string name) 74 | { 75 | return Enumerable.Range(1, count).Select(x => new EventModel 76 | { 77 | Name = $"{name} event{x}", 78 | Description = $"This is {name} event{x}'s description!" 79 | }); 80 | } 81 | 82 | public EventCollection Events { get; } 83 | 84 | private int _month = DateTime.Today.Month; 85 | 86 | public int Month 87 | { 88 | get => _month; 89 | set => SetProperty(ref _month, value); 90 | } 91 | 92 | private int _year = DateTime.Today.Year; 93 | 94 | public int Year 95 | { 96 | get => _year; 97 | set => SetProperty(ref _year, value); 98 | } 99 | 100 | private DateTime? _selectedDate = DateTime.Today; 101 | 102 | public DateTime? SelectedDate 103 | { 104 | get => _selectedDate; 105 | set => SetProperty(ref _selectedDate, value); 106 | } 107 | 108 | private DateTime _minimumDate = new DateTime(2019, 4, 29); 109 | 110 | public DateTime MinimumDate 111 | { 112 | get => _minimumDate; 113 | set => SetProperty(ref _minimumDate, value); 114 | } 115 | 116 | private DateTime _maximumDate = DateTime.Today.AddMonths(5); 117 | 118 | public DateTime MaximumDate 119 | { 120 | get => _maximumDate; 121 | set => SetProperty(ref _maximumDate, value); 122 | } 123 | 124 | private async Task ExecuteEventSelectedCommand(object item) 125 | { 126 | if (item is EventModel eventModel) 127 | { 128 | await App.Current.MainPage.DisplayAlert(eventModel.Name, eventModel.Description, "Ok"); 129 | } 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/ViewModels/TwoWeekViewPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using SampleApp.Model; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows.Input; 8 | using Xamarin.Forms; 9 | using Xamarin.Plugin.Calendar.Enums; 10 | using Xamarin.Plugin.Calendar.Models; 11 | 12 | namespace SampleApp.ViewModels 13 | { 14 | public class TwoWeekViewPageViewModel : BasePageViewModel 15 | { 16 | public ICommand TodayCommand => new Command(() => 17 | { 18 | ShownDate = DateTime.Today; 19 | SelectedDate = DateTime.Today; 20 | }); 21 | 22 | public ICommand EventSelectedCommand => new Command(async (item) => await ExecuteEventSelectedCommand(item)); 23 | 24 | public TwoWeekViewPageViewModel() : base() 25 | { 26 | // testing all kinds of adding events 27 | // when initializing collection 28 | Events = new EventCollection 29 | { 30 | [DateTime.Now.AddDays(-3)] = new List(GenerateEvents(10, "Cool")), 31 | }; 32 | 33 | // with add method 34 | Events.Add(DateTime.Now.AddDays(-1), new List(GenerateEvents(5, "Cool"))); 35 | 36 | // with indexer 37 | Events[DateTime.Now] = new List(GenerateEvents(2, "Boring")); 38 | // indexer - update later 39 | Events[DateTime.Now] = new ObservableCollection(GenerateEvents(10, "Cool")); 40 | 41 | // add later 42 | Events.Add(DateTime.Now.AddDays(3), new List(GenerateEvents(5, "Cool"))); 43 | 44 | // indexer later 45 | Events[DateTime.Now.AddDays(10)] = new List(GenerateEvents(10, "Boring")); 46 | 47 | // add later 48 | Events.Add(DateTime.Now.AddDays(15), new List(GenerateEvents(10, "Cool"))); 49 | 50 | // get observable collection later 51 | var todayEvents = Events[DateTime.Now] as ObservableCollection; 52 | 53 | // insert/add items to observable collection 54 | todayEvents.Insert(0, new EventModel { Name = "Cool event insert", Description = "This is Cool event's description!" }); 55 | todayEvents.Add(new EventModel { Name = "Cool event add", Description = "This is Cool event's description!" }); 56 | } 57 | 58 | private IEnumerable GenerateEvents(int count, string name) 59 | { 60 | return Enumerable.Range(1, count).Select(x => new EventModel 61 | { 62 | Name = $"{name} event{x}", 63 | Description = $"This is {name} event{x}'s description!" 64 | }); 65 | } 66 | 67 | public EventCollection Events { get; } 68 | 69 | private int _day = DateTime.Today.Day; 70 | 71 | public int Day 72 | { 73 | get => _day; 74 | set => SetProperty(ref _day, value); 75 | } 76 | 77 | private int _month = DateTime.Today.Month; 78 | 79 | public int Month 80 | { 81 | get => _month; 82 | set => SetProperty(ref _month, value); 83 | } 84 | 85 | private int _year = DateTime.Today.Year; 86 | 87 | public int Year 88 | { 89 | get => _year; 90 | set => SetProperty(ref _year, value); 91 | } 92 | 93 | private DateTime _shownDate = DateTime.Today; 94 | 95 | public DateTime ShownDate 96 | { 97 | get => _shownDate; 98 | set => SetProperty(ref _shownDate, value); 99 | } 100 | 101 | private WeekLayout _calendarLayout = WeekLayout.TwoWeek; 102 | 103 | public WeekLayout CalendarLayout 104 | { 105 | get => _calendarLayout; 106 | set => SetProperty(ref _calendarLayout, value); 107 | } 108 | 109 | private DateTime? _selectedDate = DateTime.Today; 110 | 111 | public DateTime? SelectedDate 112 | { 113 | get => _selectedDate; 114 | set => SetProperty(ref _selectedDate, value); 115 | } 116 | 117 | private DateTime _minimumDate = DateTime.Today.AddYears(-2).AddMonths(-5); 118 | 119 | public DateTime MinimumDate 120 | { 121 | get => _minimumDate; 122 | set => SetProperty(ref _minimumDate, value); 123 | } 124 | 125 | private DateTime _maximumDate = DateTime.Today.AddMonths(5); 126 | 127 | public DateTime MaximumDate 128 | { 129 | get => _maximumDate; 130 | set => SetProperty(ref _maximumDate, value); 131 | } 132 | 133 | private async Task ExecuteEventSelectedCommand(object item) 134 | { 135 | if (item is EventModel eventModel) 136 | { 137 | await App.Current.MainPage.DisplayAlert(eventModel.Name, eventModel.Description, "Ok"); 138 | } 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/ViewModels/WeekViewPageViewModel.cs: -------------------------------------------------------------------------------- 1 | using SampleApp.Model; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Collections.ObjectModel; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows.Input; 8 | using Xamarin.Forms; 9 | using Xamarin.Plugin.Calendar.Enums; 10 | using Xamarin.Plugin.Calendar.Models; 11 | 12 | namespace SampleApp.ViewModels 13 | { 14 | public class WeekViewPageViewModel : BasePageViewModel 15 | { 16 | public ICommand TodayCommand => new Command(() => 17 | { 18 | ShownDate = DateTime.Today; 19 | SelectedDate = DateTime.Today; 20 | }); 21 | 22 | public ICommand EventSelectedCommand => new Command(async (item) => await ExecuteEventSelectedCommand(item)); 23 | 24 | public WeekViewPageViewModel() : base() 25 | { 26 | // testing all kinds of adding events 27 | // when initializing collection 28 | Events = new EventCollection 29 | { 30 | [DateTime.Now.AddDays(-3)] = new List(GenerateEvents(10, "Cool")), 31 | }; 32 | 33 | // with add method 34 | Events.Add(DateTime.Now.AddDays(-1), new List(GenerateEvents(5, "Cool"))); 35 | 36 | // with indexer 37 | Events[DateTime.Now] = new List(GenerateEvents(2, "Boring")); 38 | // indexer - update later 39 | Events[DateTime.Now] = new ObservableCollection(GenerateEvents(10, "Cool")); 40 | 41 | // add later 42 | Events.Add(DateTime.Now.AddDays(3), new List(GenerateEvents(5, "Cool"))); 43 | 44 | // indexer later 45 | Events[DateTime.Now.AddDays(10)] = new List(GenerateEvents(10, "Boring")); 46 | 47 | // add later 48 | Events.Add(DateTime.Now.AddDays(15), new List(GenerateEvents(10, "Cool"))); 49 | 50 | // get observable collection later 51 | var todayEvents = Events[DateTime.Now] as ObservableCollection; 52 | 53 | // insert/add items to observable collection 54 | todayEvents.Insert(0, new EventModel { Name = "Cool event insert", Description = "This is Cool event's description!" }); 55 | todayEvents.Add(new EventModel { Name = "Cool event add", Description = "This is Cool event's description!" }); 56 | } 57 | 58 | private IEnumerable GenerateEvents(int count, string name) 59 | { 60 | return Enumerable.Range(1, count).Select(x => new EventModel 61 | { 62 | Name = $"{name} event{x}", 63 | Description = $"This is {name} event{x}'s description!" 64 | }); 65 | } 66 | 67 | public EventCollection Events { get; } 68 | 69 | private int _day = DateTime.Today.Day; 70 | 71 | public int Day 72 | { 73 | get => _day; 74 | set => SetProperty(ref _day, value); 75 | } 76 | 77 | private int _month = DateTime.Today.Month; 78 | 79 | public int Month 80 | { 81 | get => _month; 82 | set => SetProperty(ref _month, value); 83 | } 84 | 85 | private int _year = DateTime.Today.Year; 86 | 87 | public int Year 88 | { 89 | get => _year; 90 | set => SetProperty(ref _year, value); 91 | } 92 | 93 | private DateTime _shownDate = DateTime.Today; 94 | 95 | public DateTime ShownDate 96 | { 97 | get => _shownDate; 98 | set => SetProperty(ref _shownDate, value); 99 | } 100 | 101 | private WeekLayout _calendarLayout = WeekLayout.Week; 102 | 103 | public WeekLayout CalendarLayout 104 | { 105 | get => _calendarLayout; 106 | set => SetProperty(ref _calendarLayout, value); 107 | } 108 | 109 | private DateTime? _selectedDate = DateTime.Today; 110 | 111 | public DateTime? SelectedDate 112 | { 113 | get => _selectedDate; 114 | set => SetProperty(ref _selectedDate, value); 115 | } 116 | 117 | private DateTime _minimumDate = DateTime.Today.AddYears(-2).AddMonths(-5); 118 | 119 | public DateTime MinimumDate 120 | { 121 | get => _minimumDate; 122 | set => SetProperty(ref _minimumDate, value); 123 | } 124 | 125 | private DateTime _maximumDate = DateTime.Today.AddMonths(5); 126 | 127 | public DateTime MaximumDate 128 | { 129 | get => _maximumDate; 130 | set => SetProperty(ref _maximumDate, value); 131 | } 132 | 133 | private async Task ExecuteEventSelectedCommand(object item) 134 | { 135 | if (item is EventModel eventModel) 136 | { 137 | await App.Current.MainPage.DisplayAlert(eventModel.Name, eventModel.Description, "Ok"); 138 | } 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Views/AdvancedPage.xaml: -------------------------------------------------------------------------------- 1 |  2 | 13 | 14 | 15 | 16 | 17 | 18 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Views/AdvancedPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using Xamarin.Forms; 2 | using Xamarin.Forms.Xaml; 3 | 4 | namespace SampleApp.Views 5 | { 6 | [XamlCompilation(XamlCompilationOptions.Compile)] 7 | public partial class AdvancedPage : ContentPage 8 | { 9 | public AdvancedPage() 10 | { 11 | InitializeComponent(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Calendar.Plugin.Sample/SampleApp/Views/CalendarPickerPopup.xaml: -------------------------------------------------------------------------------- 1 |  2 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 23 | 27 |