private static void AddChildToRow(GridRepeater control, GridItem layout, int row, int col, View child)
        {
            layout.Children.Remove(child);
            var colAttached = Grid.GetColumn(child);

            col = colAttached == 0 ? col : colAttached;

            var colSpanAttached = Grid.GetColumnSpan(child);

            control.Children.Add(child as View, col, col + colSpanAttached, row, row + 1);

            if (control.Rows.Count <= row)
            {
                control.Rows.Add(new List <View>());
                if (!control.RowHeight.IsAuto)
                {
                    control.RowDefinitions.Add(new RowDefinition()
                    {
                        Height = control.RowHeight
                    });
                }
            }

            control.Rows[row].Add(child);
        }
        private static void AddHeaderOrFooter(GridRepeater control, DataTemplate template, int row)
        {
            var layout   = control.ViewFromTemplate(template, control.BindingContext) as GridItem;
            var children = layout.Children.ToArray();

            var col = 0;

            foreach (var child in children)
            {
                if (!(child is Animations.AnimationBase))
                {
                    AddChildToRow(control, layout, row, col, child);
                    col++;
                }
            }
        }