Accordion.Forms.AccordionControl.OpenAccordion C# (CSharp) Method

OpenAccordion() public method

public OpenAccordion ( AccordionEntry entry ) : void
entry AccordionEntry
return void
        void OpenAccordion(AccordionEntry entry)
        {
            // Get the element (cell) touched
            var element = m_cellStackLayout.Children.FirstOrDefault(x => x == entry.Cell);
            if (element == null)
                return;
            double position = 0;
            entry.View.Animate("expand",
                x =>
                {
                    entry.View.IsVisible = true;
                    entry.View.HeightRequest = entry.OriginalSize.Height * x;

                    // calculate te position to be scrolled based on the X from Animate and element Y position
                    position = element.Y * x;


                }, 16, AnimationDuration, Easing.SpringOut, (d, b) =>
                {
                    m_scrollView.ScrollToAsync(0, position, true);
                    entry.View.IsVisible = true;
                });
        }