I have a view tree observer like this:
rowsContainerVto = rowsContainerView.ViewTreeObserver;
rowsContainerVto.GlobalLayout += RowsContainerVto_GlobalLayout;
void RowsContainerVto_GlobalLayout (object sender, EventArgs e)
{
if(rowsContainerVto.IsAlive)
rowsContainerVto.GlobalLayout -= RowsContainerVto_GlobalLayout;
vW = rowsContainerView.Width;
Console.WriteLine ("\r now width is " + vW);
}
What it is supposed to do is to find the width after the view is laid out, which it does perfectly. I just can't figure out how to stop this from running over and over again.
Above is basically based on the suggestion made. This only makes the app crash. When i get rid of the "IsAlive", the loop continue forever. I just can't seem to find a way to stop it after the first time it was drawn and laid out.