From 2a97d85ad26efed514b480ac5474e2d8d60ee455 Mon Sep 17 00:00:00 2001 From: AntonioSeric Date: Sun, 3 Oct 2021 19:27:46 +0200 Subject: [PATCH] fix event view --- .../SampleApp/ViewModels/AdvancedPageViewModel.cs | 2 ++ .../ViewModels/RangeSelectionPageViewModel.cs | 12 ++++++++---- .../SampleApp/ViewModels/SimplePageViewModel.cs | 5 +++++ .../Shared/Controls/GenericRepeaterView.cs | 1 + 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Calendar.Plugin.Sample/SampleApp/ViewModels/AdvancedPageViewModel.cs b/src/Calendar.Plugin.Sample/SampleApp/ViewModels/AdvancedPageViewModel.cs index 9dc5a76..4842489 100644 --- a/src/Calendar.Plugin.Sample/SampleApp/ViewModels/AdvancedPageViewModel.cs +++ b/src/Calendar.Plugin.Sample/SampleApp/ViewModels/AdvancedPageViewModel.cs @@ -23,6 +23,8 @@ public class AdvancedPageViewModel : BasePageViewModel public AdvancedPageViewModel() : base() { + Device.BeginInvokeOnMainThread(async () => await App.Current.MainPage.DisplayAlert("Info", "Loading events with delay, and changeing current view.", "Ok")); + Culture = CultureInfo.CreateSpecificCulture("en-GB"); // testing all kinds of adding events // when initializing collection diff --git a/src/Calendar.Plugin.Sample/SampleApp/ViewModels/RangeSelectionPageViewModel.cs b/src/Calendar.Plugin.Sample/SampleApp/ViewModels/RangeSelectionPageViewModel.cs index ce7203e..8a29d3f 100644 --- a/src/Calendar.Plugin.Sample/SampleApp/ViewModels/RangeSelectionPageViewModel.cs +++ b/src/Calendar.Plugin.Sample/SampleApp/ViewModels/RangeSelectionPageViewModel.cs @@ -40,11 +40,15 @@ public RangeSelectionPageViewModel() : base() [DateTime.Now.AddDays(-10)] = new List(GenerateEvents(10, "Cool", DateTime.Now.AddDays(-10))), [DateTime.Now.AddDays(1)] = new List(GenerateEvents(2, "Boring", DateTime.Now.AddDays(1))), [DateTime.Now.AddDays(4)] = new List(GenerateEvents(10, "Cool", DateTime.Now.AddDays(4))), - [DateTime.Now.AddDays(8)] = new List(GenerateEvents(10, "Cool", DateTime.Now.AddDays(8))), + [DateTime.Now.AddDays(8)] = new List(GenerateEvents(1, "Cool", DateTime.Now.AddDays(8))), [DateTime.Now.AddDays(9)] = new List(GenerateEvents(10, "Cool H", DateTime.Now.AddDays(9))), - [DateTime.Now.AddDays(10)] = new List(GenerateEvents(10, "Cool X", DateTime.Now.AddDays(10))), - [DateTime.Now.AddDays(16)] = new List(GenerateEvents(10, "Cool B", DateTime.Now.AddDays(16))), - [DateTime.Now.AddDays(20)] = new List(GenerateEvents(10, "Cool A", DateTime.Now.AddDays(20))), + [DateTime.Now.AddDays(10)] = new List(GenerateEvents(100, "Cool X", DateTime.Now.AddDays(10))), + [DateTime.Now.AddDays(16)] = new List(GenerateEvents(7, "Cool B", DateTime.Now.AddDays(16))), + [DateTime.Now.AddDays(20)] = new List(GenerateEvents(9, "Cool A", DateTime.Now.AddDays(20))), + [DateTime.Now.AddDays(35)] = new List(GenerateEvents(1, "Cool S", DateTime.Now.AddDays(35))), + [DateTime.Now.AddDays(43)] = new List(GenerateEvents(4, "Cool Q", DateTime.Now.AddDays(43))), + [DateTime.Now.AddDays(46)] = new List(GenerateEvents(12, "Cool ZZ", DateTime.Now.AddDays(46))), + [DateTime.Now.AddDays(51)] = new List(GenerateEvents(3, "Cool Y", DateTime.Now.AddDays(51))), }; ShownDate = ShownDate.AddMonths(1); diff --git a/src/Calendar.Plugin.Sample/SampleApp/ViewModels/SimplePageViewModel.cs b/src/Calendar.Plugin.Sample/SampleApp/ViewModels/SimplePageViewModel.cs index fac3308..f329340 100644 --- a/src/Calendar.Plugin.Sample/SampleApp/ViewModels/SimplePageViewModel.cs +++ b/src/Calendar.Plugin.Sample/SampleApp/ViewModels/SimplePageViewModel.cs @@ -22,11 +22,16 @@ public class SimplePageViewModel : BasePageViewModel public SimplePageViewModel() : base() { + Device.BeginInvokeOnMainThread(async () => await App.Current.MainPage.DisplayAlert("Info", "Loading events with delay, and changeing current view.", "Ok")); + // testing all kinds of adding events // when initializing collection Events = new EventCollection { [DateTime.Now.AddDays(-3)] = new List(GenerateEvents(10, "Cool")), + [DateTime.Now.AddDays(4)] = new List(GenerateEvents(2, "Simple2")), + [DateTime.Now.AddDays(2)] = new List(GenerateEvents(1, "Simple1")), + [DateTime.Now.AddDays(1)] = new List(GenerateEvents(3, "Simple3")), }; // with add method diff --git a/src/Calendar.Plugin/Shared/Controls/GenericRepeaterView.cs b/src/Calendar.Plugin/Shared/Controls/GenericRepeaterView.cs index 119ae6b..19e768c 100644 --- a/src/Calendar.Plugin/Shared/Controls/GenericRepeaterView.cs +++ b/src/Calendar.Plugin/Shared/Controls/GenericRepeaterView.cs @@ -42,6 +42,7 @@ public DataTemplate EmptyTemplate internal GenericRepeaterView() { Spacing = 0; + VerticalOptions = LayoutOptions.StartAndExpand; } #region PropertyChanged