using System; using System.Collections.Generic; using Xamarin.Forms; namespace Samples { public partial class XamlPreviewPage : ContentPage { public XamlPreviewPage () { InitializeComponent (); editor.Text = @" "; DisplayXaml (); } public void DisplayXaml () { var asm = typeof (Xamarin.Forms.Xaml.Internals.XamlTypeResolver).Assembly; var xamlLoaderType = asm.GetType ("Xamarin.Forms.Xaml.XamlLoader"); var loadArgTypes = new[] { typeof (object), typeof (string) }; var loadMethod = xamlLoaderType.GetMethod ("Load", System.Reflection.BindingFlags.Static|System.Reflection.BindingFlags.Public, null, System.Reflection.CallingConventions.Any, loadArgTypes, null); var contentView = new ContentView (); loadMethod.Invoke (null, new object[] { contentView, editor.Text }); results.Content = contentView; } } }