Do you use know how to consistently style your app?

Last updated by TiagoAraujo over 3 years ago.See history

Branding is important in any product, and especially a mobile app. Xamarin offers several ways to define and ensure consistent styling throughout your app:

  • Resource Dictionaries
  • CSS
  • Visual

xamarin style bad
Figure: Bad Example - same styling defined and repeated multiple times

xamarin style good
Figure: Good Example - Styles defined once in resource dictionary and applied to controls

Resource Dictionaries and CSS provide similar capabilities, but Resource Dictionaries are the best way to style your Xamarin applications. CSS in Xamarin is not full, web-standards compliant CSS, but rather an alternative way to write Xamarin styles than Resource Dictionaries. CSS in Xamarin does not currently support the full range of properties available, but it may be more comfortable for those familiar with web development.

Visual offers a much more granular level control over the look and feel of your application. However, this increase in granularity comes with a proportionally increased level of complexity. Rather than providing a style, you need to define a custom renderer for every control you want to define the look of.

Visual is suitable for large teams with a design heavy focus, where branding is of paramount importance. The advantage of Visual is that you can specify it at individual control level, at page level, or at whole of app-level to ensure your entire app is consistent.

We open source. Powered by GitHub