I have a content page with two distinct pieces of UI. To manage this, I have a grid with two rows, and the page starts out with one RowDefinition being * and the other being 0. I have a button the user clicks to show the data in the second row, which it does by changing the row height. The code to do this looks like this:
GridLength glHidden = new GridLength(0, GridUnitType.Absolute);
GridLength glShow = new GridLength(1, GridUnitType.Star);
var rows = PageGrid.RowDefinitions;
rows[2].Height = glHidden;
rows[3].Height = glShow;
When I run this on iOS it works perfect, exactly as I would expect. When I run it on Android, nothing happens the first time I toggle it. I toggle it back like so (simplified):
rows[2].Height = glShow;
rows[3].Height = glHidden;
Since the height of row 2 didn't change when I toggled it the first time, it continues to look like nothing happened. Then when I run the toggle code the third time, it works on Android - row 2 disappears and row 3 shows up.
So...is there some other way in which I should be doing this? Alternatively, I thought about changing the Grid.Row property of the UI I'm trying to toggle, but I can't find a way to do this in the code behind. If that way works uniformly on all operating systems then a pointer to how one might try that would be welcome.