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

Custom Layout, override OnSizeRequest bug?

$
0
0

I've created a custom layout called HorizontalWrapLayout, which subclasses Layout, and have overridden OnSizeRequest. I seem to be getting strange behavior...

I return this line:
return new SizeRequest(new Size(widthRequest, heightRequest), new Size(minWidthRequest, minHeightRequest));

Stepping through the debugger, I see the following values for those local variables:

widthRequest: -1
minWidthRequest -1
heightRequest: 92
minHeightRequest: 44

Width is working fine, and I don't mean to be requesting anything in particular here, so feel free to ignore that part. The part I am interested in is the height. It seems like minHeightRequest is having an affect on the rendered height of the element, even when it's less than the heightRequest. Does that make any sense? 92 is the height that I want here. I've experimented with different values for minHeightRequest, and notice that when I set minHeightRequest to 1, the rendered element is shorter than when I set minHeightRequest to 80. I either have a misunderstanding of how heightRequest and minHeightRequest are supposed to be used, (I assume that the caller will take the max of the two??,) or else there might be a bug here. Can someone please help to shed some light? If you need a code example I could work on one, but it's totally just tangled up in my app right now and would take some time to put together.

Thanks!

Cristina


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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