Converting Xamarin.Forms to WindowsUI and Uno: SafeArea to VisibleBoundsPadding

Converting a Xamarin.Forms application across to use WinUI + Uno is mostly straight forward as a lot of the XAML is either the same, or has an equivalent. When you’re dealing with platform specifics, one thing you might come across is the SetUseSafeArea call. For example:

On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true);

The Uno platform exposes the concept of safe area using the VisibleBoundsPadding behavior. This can be done for all supported platforms using the toolkit namespace prefix (xmlns:toolkit="using:Uno.UI.Toolkit") eg

toolkit:VisibleBoundsPadding.PaddingMask="All"

Alternatively, you can specify individual platforms using the platform specific namespace prefix (xmlns:ios="http://uno.ui/ios") eg

ios:VisibleBoundsPadding.PaddingMask="All"

Don’t forget to add any of the platform specific namespaces to the ignorable list (eg mc:Ignorable="d ios")