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

Custom layout, override OnSizeRequest returns wrong height?

$
0
0

Hi there!

Been making some customlistview by extending Layout and overriding some of the methods.

For some reason the code below give me the wrong height, the height should be around 45, but it makes it like 24 pixel high instead. I can fix this by hardcode a height in the gridlayout in xaml code.. but this is something i dont want to do..

protected override SizeRequest OnSizeRequest(double widthConstraint, double heightConstraint)
        {
            var totalHeight = Children.Sum(child => child.GetSizeRequest(widthConstraint, heightConstraint).Request.Height);            
         return new SizeRequest(new Size(widthConstraint, totalHeight));
        }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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