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

How to bypass the Android PageRenderer OnLayout override?

$
0
0

Ok, I know this is really bad practice, but I want to try this whilst waiting for an update to XF itself.

The XF Android PageRenderer currently contains:

        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);
            OrderedTraversalController.UpdateTraversalOrder();
        }

Unfortunately, OrderedTraversalController.UpdateTraversalOrder is not virtual and I want to replace it as it doesn't do what I want (this is already the subject of an enhancement request).

My thinking is that I create a custom page renderer that overrides OnLayout. That override then does nasty stuff using reflection to call base.base.OnLayout(changed, l, t, r, b), bypassing the PageRenderer OnLayout in order to avoid calling OrderedTraversalController.UpdateTraversalOrder();

It's fragile and it's nasty, but it will do as a temporary workaround until XF is updated.

So, the question is, how would the reflection code in the OnLayout in the custom page renderer be written in order to make that call to base.base.OnLayout(changed, l, t, r, b) ? Any help gratefully received :-)


Viewing all articles
Browse latest Browse all 89864

Latest Images

Trending Articles



Latest Images