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:


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


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


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