private void Setup() { this.BackgroundColor = Color.FromHex(AppTheme.DefaultBackgroundColor()); AbsoluteLayout layout = new AbsoluteLayout(); // background image AbsoluteLayout.SetLayoutFlags(this.ImageBackground, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(this.ImageBackground, new Rectangle(0, 0.5, 1, 1)); layout.Children.Add(this.ImageBackground); this.StackDisclaimer.Children.Add(this.LabelAdultWarning); this.StackDisclaimer.Children.Add(this.LabelDisclaimer); // center label AbsoluteLayout.SetLayoutFlags(this.StackDisclaimer, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(this.StackDisclaimer, new Rectangle(0.5, 0.5, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); layout.Children.Add(this.StackDisclaimer); // align to bottom button AbsoluteLayout.SetLayoutFlags(this.DismissButton, AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.WidthProportional); AbsoluteLayout.SetLayoutBounds(this.DismissButton, new Rectangle(0, 1, 1, 60)); layout.Children.Add(this.DismissButton); // update size based on device if (Device.Idiom == TargetIdiom.Tablet) { this.LabelDisclaimer.FontSize = 24; } if (Device.Idiom == TargetIdiom.Phone) { this.LabelDisclaimer.FontSize = 17; } Content = layout; }
protected BaseContentPage() { this.BackgroundColor = Color.FromHex(AppTheme.DefaultBackgroundColor()); BindingContext = ViewModel; }
public BaseNavigationPage(Page root) : base(root) { BarBackgroundColor = Color.FromHex(AppTheme.DefaultBarBackgroundColor()); BackgroundColor = Color.FromHex(AppTheme.DefaultBackgroundColor()); BarTextColor = Color.FromHex(AppTheme.DefaultTextColor()); }