private async void TodayButton_Clicked(object sender, EventArgs e) { if (TodayIndex >= 0) { var today = DateTime.Today; if (TodayIndex > 1) { await ScrollView_SlidingContainer.ScrollToAsync(StackLayout_Container.Children[TodayIndex - 2], ScrollToPosition.Start, true); } else { await ScrollView_SlidingContainer.ScrollToAsync(StackLayout_Container.Children[TodayIndex], ScrollToPosition.Start, true); } if (prevStack != null) { prevStack.BackgroundColor = Color.Transparent; } StackLayout_Container.Children[TodayIndex].BackgroundColor = Color.FromHex("#60eeeeee"); prevStack = (StackLayout)StackLayout_Container.Children[TodayIndex]; Label_CaptionDate.Text = today.ToString(DATE_FORMAT); SlidingEventArgs se = new SlidingEventArgs(today); DayItem_Tapped?.Invoke(sender, se); } }
private void DayPart_Tapped(object sender, EventArgs e) { var stackLayout = (StackLayout)sender; if (prevStack != null) { prevStack.BackgroundColor = Color.Transparent; } stackLayout.BackgroundColor = Color.FromHex("#60eeeeee"); prevStack = stackLayout; var date = (DateTime)((TapGestureRecognizer)(stackLayout).GestureRecognizers[0]).CommandParameter; Label_CaptionDate.Text = date.ToString(DATE_FORMAT); SlidingEventArgs se = new SlidingEventArgs(date); DayItem_Tapped?.Invoke(sender, se); }