Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,376 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want set Appshell NavBar and TabBar Invisible when Device is Horizontal and visible when Vertical.
I code like following , it works fine in IOS, but when Android device changed to Horizontal, the object on NavBar and TabBar is disappeared and both of bar is still there and TabBar become black.
I think the page refresh event is quick than OnSizeAllocated, but I don't know how to refresh page again after by code.
Please help me!
protected override void OnSizeAllocated(double width, double height)
{
//When device is rotated to Horizontal, change legend orientation
if (this.Width > this.Height)
{ //Horizontal
AppShell.SetNavBarIsVisible(this, false);
AppShell.SetTabBarIsVisible(this, false);
}
else
{ //Vertical
AppShell.SetNavBarIsVisible(this, true);
AppShell.SetTabBarIsVisible(this, true);
}
base.OnSizeAllocated(width, height);
}