void CheckShadow(Page page, bool pushed = false) { IReadOnlyList <Page> stack = Element?.Navigation?.NavigationStack; if (pushed) { bool showShadow = stack?.Count > 1 || TitleViewExtensions.GetIsShadowVisible(page); NavigationBar.Layer.ShadowOpacity = showShadow ? 0.5f : 0; } else { UpdateShadowOpacityOnPop(stack, page); } }
void UpdateShadowOpacityOnPop(IReadOnlyList <Page> stack, Page page = null) { if (stack != null && stack.Count <= 2) { bool shadowPropertyValue = false; if (stack.Count > 1) { Page newPage = stack[stack.Count - 2]; shadowPropertyValue = TitleViewExtensions.GetIsShadowVisible(newPage); } bool hideShadow = (page != null && stack?.Last <Page>() == page) && !shadowPropertyValue; NavigationBar.Layer.ShadowOpacity = hideShadow ? 0 : 0.5f; } }
public MainPage() { InitializeComponent(); TitleViewExtensions.SetIsShadowVisible(this, false); }