Themes in Xamarin.iOS are analogous to Views in Xamarin.Android. Like Views, Themes let you set a Screenlet’s look and feel independent of the Screenlet’s core functionality. Liferay’s Screenlets come with several Themes, and more are being developed by Liferay and the community. The Screenlet reference documentation lists the Themes available for each Screenlet included with Screens. This tutorial shows you how to use Themes in Xamarin.iOS.
Follow these steps to install and use a Theme:
If the Theme is packaged as a NuGet dependency, you can install it in your project via NuGet. To do so, right-click your project’s Packages folder and then select Add packages…. Then search for the Theme and install it. If the Theme isn’t available in NuGet, you can drag and drop the Theme’s folder directly into your project.
To use the installed Theme, set its name to the Screenlet instance’s
ThemeNameproperty in your view controller that implements the Screenlet’s delegate. All Screenlets inherit this property from
BaseScreenlet. For example, this code sets Login Screenlet’s
ThemeNameproperty to the Material Theme:
loginScreenlet.ThemeName = "material"
If you don’t set this property or enter an invalid or missing Theme, the Screenlet uses its Default Theme. Each Screenlet’s available Themes are listed in the Themes section of the Screenlet’s reference documentation.
Great, that’s it! Now you know how to use Themes to dress up Screenlets in your Xamarin.iOS apps.