public DashboardPage () { NavigationPage.SetHasNavigationBar (this, false); BackgroundColor = Color.White; Title = "DashboardPage"; screenWidth = DeviceInfo.Hardware.ScreenWidth; screenHeight = DeviceInfo.Hardware.ScreenHeight; #region Padding Box BoxView paddingBoxView = new BoxView { Color = Color.White, HeightRequest = (Device.OS == TargetPlatform.iOS) ? 20 : 0, }; #endregion #region My Buttons levelAButton = new Button { Text = "Level A", HeightRequest = 20 }; #endregion #region My Footer NavBar myFooterNavBar = new MyFooterNavBar { VerticalOptions = LayoutOptions.EndAndExpand, }; #endregion #region Page Layout pageLayout = new AbsoluteLayout { Children = { myFooterNavBar, levelAButton, paddingBoxView }, }; double paddingBoxViewHeight = 20; double paddingBoxViewY = 0; double levelAButtonHeight = 20; double levelAButtonY = paddingBoxViewHeight; double myFooterNavBarHeight = 50.5; double myFooterNavBarY = screenHeight - myFooterNavBarHeight; AbsoluteLayout.SetLayoutFlags (paddingBoxView, AbsoluteLayoutFlags.None); AbsoluteLayout.SetLayoutBounds(paddingBoxView, new Rectangle(0, paddingBoxViewY, screenWidth, paddingBoxViewHeight)); AbsoluteLayout.SetLayoutFlags (levelAButton, AbsoluteLayoutFlags.None); AbsoluteLayout.SetLayoutBounds(levelAButton, new Rectangle(0, levelAButtonY, screenWidth, levelAButtonHeight)); AbsoluteLayout.SetLayoutFlags (myFooterNavBar, AbsoluteLayoutFlags.None); AbsoluteLayout.SetLayoutBounds(myFooterNavBar, new Rectangle(0, myFooterNavBarY, screenWidth, AbsoluteLayout.AutoSize)); #endregion Content = pageLayout; }
public LevelAPage () { NavigationPage.SetHasNavigationBar (this, false); /*if (Device.OS == TargetPlatform.iOS) { // move layout under the status bar Padding = new Thickness (0, 20, 0, 0); }*/ BackgroundColor = Color.White; Title = "Level A"; screenWidth = DeviceInfo.Hardware.ScreenWidth; screenHeight = DeviceInfo.Hardware.ScreenHeight; #region Padding Box BoxView paddingBoxView = new BoxView { Color = Color.White, HeightRequest = (Device.OS == TargetPlatform.iOS) ? 20 : 0, }; #endregion #region Menu Title Bar myAccordionNavBar = new MyAccordionNavBar (this, Title, out menuSize); #endregion #region My Tool Bar string topBarLabelText = "BAR LABEL TEXT"; string topBarLeftIcon = "< "; string topBarRightIcon = "> "; myToolBar = new MyToolBar (topBarLabelText, topBarLeftIcon, topBarRightIcon); #endregion #region My ListView myListView = new ListView { ItemsSource = new [] { "A", "B", "C", "D", "E", "F", "H", "I", "J", "K", "L", "M" } }; #endregion #region My Footer Nav Bar myFooterNavBar = new MyFooterNavBar { //VerticalOptions = LayoutOptions.End, }; #endregion #region Accordion Nav Tap Fix BoxView double fixBoxViewWH = 30D; FixBoxView = new BoxView { Color = Color.White, WidthRequest = fixBoxViewWH, HeightRequest = fixBoxViewWH, Opacity = .1D, IsVisible = false }; fixBoxViewGestureRecognizer = new TapGestureRecognizer (); #endregion #region Page Layout pageLayout = new AbsoluteLayout { Children = { myListView, myFooterNavBar, myToolBar, myAccordionNavBar, FixBoxView, paddingBoxView }, }; double paddingBoxViewHeight = 20D; double paddingBoxViewY = 0D; double myAccordionNavLayoutHeight = 70D; double myAccordionNavLayoutY = menuSize * -1; //double fixBoxViewHeight = 30D; double navBarLabelWidth = 25D; double navBarLabelX = 334.75D; double navBarLabelEndX = navBarLabelX + navBarLabelWidth; double fixBoxViewX = navBarLabelX; double fixBoxViewEndX = fixBoxViewX + fixBoxViewWH; double avgFixBoxNavBarEndX = (navBarLabelEndX + fixBoxViewEndX) / 2; double avgFixBoxNavBarStartX = avgFixBoxNavBarEndX - fixBoxViewWH; double navBarLabelHeight = 17D; double navBarLabelY = 33D; double navBarLabelEndY = navBarLabelY + navBarLabelHeight; double fixBoxViewY = navBarLabelY; double fixBoxViewEndY = fixBoxViewY + fixBoxViewWH; double avgFixBoxNavBarEndY = (navBarLabelEndY + fixBoxViewEndY) /2; double avgFixBoxNavBarStartY = avgFixBoxNavBarEndY - fixBoxViewWH; double myToolBarLayoutHeight = 44.5D; double myToolBarLayoutY = paddingBoxViewHeight + myToolBarLayoutHeight; double myFooterNavBarHeight = 50.5D; double myFooterNavBarY = screenHeight - myFooterNavBarHeight; myListViewHeight = screenHeight - myAccordionNavLayoutHeight - myToolBarLayoutHeight - myFooterNavBarHeight; myListViewY = myAccordionNavLayoutHeight + myToolBarLayoutHeight; AbsoluteLayout.SetLayoutFlags (paddingBoxView, AbsoluteLayoutFlags.None); AbsoluteLayout.SetLayoutBounds(paddingBoxView, new Rectangle(0, paddingBoxViewY, screenWidth, paddingBoxViewHeight)); AbsoluteLayout.SetLayoutFlags (myAccordionNavBar, AbsoluteLayoutFlags.None); AbsoluteLayout.SetLayoutBounds(myAccordionNavBar, new Rectangle(0, myAccordionNavLayoutY, screenWidth, myAccordionNavLayoutHeight)); AbsoluteLayout.SetLayoutFlags (myToolBar, AbsoluteLayoutFlags.None); AbsoluteLayout.SetLayoutBounds(myToolBar, new Rectangle(0, myToolBarLayoutY, screenWidth, myToolBarLayoutHeight)); AbsoluteLayout.SetLayoutFlags (myListView, AbsoluteLayoutFlags.None); AbsoluteLayout.SetLayoutBounds(myListView, new Rectangle(0, myListViewY, screenWidth, myListViewHeight)); AbsoluteLayout.SetLayoutFlags (myFooterNavBar, AbsoluteLayoutFlags.None); AbsoluteLayout.SetLayoutBounds(myFooterNavBar, new Rectangle(0, myFooterNavBarY, screenWidth, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutFlags (FixBoxView, AbsoluteLayoutFlags.None); AbsoluteLayout.SetLayoutBounds(FixBoxView, new Rectangle(avgFixBoxNavBarStartX, avgFixBoxNavBarStartY, fixBoxViewWH, fixBoxViewWH)); #endregion Content = pageLayout; }