Add new event to Layout.cs -> ChildMeasureInvalidated(object sender, EventArgs e)

RyanDixonRyanDixon USMember ✭✭✭
edited August 2017 in Xamarin.Forms


At the moment, you can only detect when the layout's measure is invalidated. With this change, it will expose an additional event giving us the child which caused the invalidation to process up the stack.

API Changes

One new event will be exposed on Layout.cs called ChildMeasureInvalidated.
Layout.cs -> under line # 194

Intended Use Case

Gives the end user more control over the layout, allowing them to know exactly what children are invalidated and when. This could be used to enhance caching in custom layouts further improving the performance of such layouts.


Edit: Another alternative would be to expose the sender as an optional parameter onto the virtual method if this removes the need for events!

I might be hugely wrong on this, and it would be cool to get other peoples thoughts as its a tiny change!
The idea came along as I have my own "InfiniteLayout" which loads views in when scrolling and loops over itself, and currently I can only invalidate all the SizeMeasures at once.
I don't mind adding this myself in a PR!



Open · Last Updated

Sign In or Register to comment.