Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

what is the best place to set autolayout bounds when trying to emulate the grid's AUTO

$
0
0

code currently looks like this but I'm not sure where the proper place to put it is so that I don't get layout cycles or something. It emulate's an Auto, *, Auto row grid.

        var parentHeight = ParentView.Height;

        var headerHeight = Math.Ceiling(_headerLayout.GetSizeRequest(double.PositiveInfinity, double.PositiveInfinity).Request.Height);
        AbsoluteLayout.SetLayoutFlags(_headerLayout, AbsoluteLayoutFlags.WidthProportional);
        AbsoluteLayout.SetLayoutBounds(_headerLayout, new Rectangle(0, 0, 1, headerHeight));

        var footerHeight = Math.Ceiling(_messageSenderView.GetSizeRequest(double.PositiveInfinity, double.PositiveInfinity).Request.Height);
        AbsoluteLayout.SetLayoutFlags(_messageSenderView, AbsoluteLayoutFlags.WidthProportional);
        AbsoluteLayout.SetLayoutBounds(_messageSenderView, new Rectangle(0, parentHeight - footerHeight, 1, footerHeight));

        AbsoluteLayout.SetLayoutFlags(_headerLayout, AbsoluteLayoutFlags.WidthProportional);
        AbsoluteLayout.SetLayoutBounds(_headerLayout, new Rectangle(0, headerHeight, 1, parentHeight - headerHeight - footerHeight));

Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>