public AccordionCell() { //Init headerView = new ContentView(); detailView = new ContentView { IsVisible = true }; //TapGesture for hiding and showing var tapGesture = new TapGestureRecognizer(); tapGesture.Tapped += (sender, e) => { Action <double> callback = input => detailView.Content.HeightRequest = input; double startingHeight = detailView.Content.Height; double endingHeight = -1; uint rate = 16; uint length = 3000; Easing easing = Easing.CubicOut; detailView.Animate("accordion", callback, startingHeight, endingHeight, rate, length, easing); this.ForceUpdateSize(); }; headerView.GestureRecognizers.Add(tapGesture); //Setting Cell View View = new StackLayout { Children = { headerView, detailView } }; }
private void AnimateTranslation(float endX, bool fullSwipe) { int alpha = fullSwipe ? 0 : 1; bool swipingLeft = endX < 0; bool swipingRight = endX > 0; ContentView.Animate().SetDuration(SwipeAnimationDuration) .Alpha(alpha) .TranslationX(endX) .WithEndAction(new Runnable(() => { if (fullSwipe) { if (swipingLeft) { OnFullSwipeLeft(); ResetView(); } else if (swipingRight) { OnFullSwipeRight(); ResetView(); } } })); this.Animate().SetDuration(SwipeAnimationDuration).Alpha(alpha); }