/// <summary> /// Adds the main button to layout. /// </summary> /// <param name="layout">Layout.</param> private void AddButtonToLayout(ActionButton button, RelativeLayout layout) { layout.Children.Add(button, () => Direction == ExpandDirection.Up ? // Up new Rectangle(0, layout.Height - layout.Width, layout.Width, layout.Width) : // Down Direction == ExpandDirection.Down ? new Rectangle(0, 0, layout.Width, layout.Width) : // Left Direction == ExpandDirection.Left ? new Rectangle(layout.Width - layout.Height, 0, layout.Height, layout.Height) : // Right new Rectangle(0, 0, layout.Height, layout.Height) ); }
/// <summary> /// Adds the main button to layout. /// </summary> /// <param name="layout">Layout.</param> private void AddButtonToLayout (ActionButton button, RelativeLayout layout) { layout.Children.Add (button, () => Direction == ExpandDirection.Up ? // Up new Rectangle(0, layout.Height-layout.Width, layout.Width, layout.Width) : // Down Direction == ExpandDirection.Down ? new Rectangle(0, 0, layout.Width, layout.Width) : // Left Direction == ExpandDirection.Left ? new Rectangle(layout.Width-layout.Height, 0, layout.Height, layout.Height) : // Right new Rectangle(0, 0, layout.Height, layout.Height) ); }
public MapPage() { NavigationPage.SetTitleIcon(this, "allergieradar_tab.png"); //NavigationPage.HeightProperty(this,50); var browser = new BaseUrlWebView(); // temporarily use this so we can custom-render in iOS var htmlSource = new HtmlWebViewSource() { Html = @" <html> <head> <link rel=""stylesheet"" href=""default.css""> <script> window.location.replace(""country.html""); </script> </head> <body> </body> </html>", BaseUrl = DependencyService.Get <IBaseUrl>().Get() }; browser.Source = htmlSource; AbsoluteLayout simpleLayout = new AbsoluteLayout { VerticalOptions = LayoutOptions.FillAndExpand }; //var bottomRightLabel = new ActionButton() //{ // Margin = 5 //}; var bottomRightLabel = new NControl.Controls.ActionButton { ButtonColor = Color.FromHex("#2196F3"), //ButtonIcon = FontAwesomeLabel.FAPlus, Margin = 5, }; globalComplaintScore = new Label() { Margin = 15, Text = "0", FontSize = 40, TextColor = Color.White, IsVisible = true }; Label globalComplaintText = new Label() { Margin = 15, Text = "Landelijke\nklachtenscore", FontSize = 16, TextColor = Color.White, IsVisible = true }; GetGlobalComplaintScore(); var command = new Command(() => OpenModal()); bottomRightLabel.Command = command; AbsoluteLayout.SetLayoutFlags(bottomRightLabel, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutFlags(bottomRightLabel, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(bottomRightLabel, new Rectangle(1f, 1f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutBounds(globalComplaintScore, new Rectangle(0f, 0f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutBounds(globalComplaintText, new Rectangle(0f, 50f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); AbsoluteLayout.SetLayoutFlags(browser, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(browser, new Rectangle(0, 0, 1, 1)); simpleLayout.Children.Add(browser); simpleLayout.Children.Add(globalComplaintScore); simpleLayout.Children.Add(globalComplaintText); if (!string.IsNullOrEmpty(LoggedinUser.Password)) { //simpleLayout.Children.Add(bottomRightLabel,new Rectangle((simpleLayout.Width / 4) - (56 / 2), (simpleLayout.Height / 2) - (56 / 2), 56, 56)); simpleLayout.Children.Add(bottomRightLabel); } Content = simpleLayout; }