ContentPage2

RedCorners.Forms.ContentPage2 is an enhanced version of ContentPage. It is the recommended base type for pages, when RedCorners.Forms is used. It offers very handy features including:

  • Automatically adjusting the paddings based on the device safe insets (e.g. Notch offsets), via the FixTopPadding and FixBottomPadding bindable properties.
  • Adjusting the iOS status bar style via the UIStatusBarStyle bindable property.
  • Adjusting the iOS status bar visibility via the UIStatusBarHidden bindable property.
  • Toggling the animation on the iOS status bar when changing its properties, via the UIStatusBarAnimated bindable property.
  • Bindable properties to adjust Android’s status bar color, translucency and overlapping with the page.
  • Forcing keeping the screen on or off via the KeepScreenOn bindable property.
  • Propagating Appearing/Disappearing messages to child ContentView2 controls and any bindable view that has a BindableModel binding context.
  • Propagating the back button press signal to a BindableModel binding context.

Properties

bool FixTopPadding, bool FixBottomPadding

When true, ContentPage2 overrides its top and/or bottom components of its Padding property to values retrieved from NotchSystem.Instance.GetPageMargin().

By default, this means you can make sure your UI controls won’t overlap with the iOS notch or the task switching hot area on the bottom of the screen, if you turn on these properties.

On devices without notch, by default the padding values are set to zero.

You can always override or augment these values using the NotchSystem singleton. For more information, read the docs for NotchSystem.

UIStatusBarStyles UIStatusBarStyle

This iOS-specific bindable property changes the style of the status bar. The valid values are:

  • Default (0),
  • LightContent (1),
  • BlackOpaque (2)

bool UIStatusBarHidden

This iOS-specific bindable property hides or shows the status bar on the iOS. Its default value is false.

bool UIStatusBarAnimated

This iOS-specific bindable property enables or disables animation when the UIStatusBarHidden or UIStatusBarStyle values are modified. Its default value is true.

Color AndroidStatusBarColor, bool AndroidTranslucentStatus, bool AndroidLayoutInScreen

These Android-specific bindable properties adjust the appearance of the status bar. These are experimental properties and modifying them may cause unexpected behavior.

bool? KeepScreenOn

This value forces the screen to always stay on or go to sleep after a while, depending whether it is set to true or false. If it is set to null, it uses the existing policy by the system. By default it is set to null.

Methods

IEnumerable<ContentView2> GetAliveChildren()

This method recursively seeks and returns all ContentView2 children of the page.