Thursday, November 9, 2017

XAML Compilation

Using the XAML compiler to increase the performance of a Xamarin.Forms appXAML can be optionally compiled directly into intermediate language (IL) with the XAML compiler (XAMLC).XAMLC offers a number of a benefits:It performs compile-time checking of XAML, notifying the user of any errors.It removes some of the load and instantiation time for XAML elements.XAMLC is disabled by default to ensure backwards compatibility. It can be enabled at both the assembly and class level by adding the XamlCompilation attribute.The following code example demonstrates enabling XAMLC at the assembly level:It helps to reduce the file size of the final assembly by no longer including .xaml files.The following code example demonstrates enabling XAMLC at the assembly level:

using Xamarin.Forms.Xaml;

[assembly: XamlCompilation(XamlCompilationOptions.Compile)]You can also enable XAMLC at the class level