How to Preview XAML in Xamarin.Forms in Xamarin Sketches

Asked 3 months ago, Updated 3 months ago, 13 views

Xamarin Studio 5.6.3 build 3 uses Sketches functionality. I wish I could preview the XAML file when I use it in Xamarin.Forms mode, but unfortunately it doesn't seem to offer this feature.

Is there a good way?


2022-09-30 12:06

1 Answers

The XAML loader provided by the method in Xamarin.Forms can be used by reflection. Paste the following code into the Sketches text area

using Xamarin.Forms;
using System.Reflection;
using System.Runtime.CompilerServices;
using Xamarin.Forms.Xaml;

var [email protected]"<?xml version="1.0""encoding="utf-8""?>
<ContentPage xmlns="""xmlns:x="""x:Class="XamlSamples.HelloXamlPage""
             Title= "Hello XAML Page"
             Padding="10, 40, 10, 10" >

  <Label Text="Hello, XAML Sketch!"
         VerticalOptions= "Start"
         Font="Bold, 80"
         TextColor="Red" / >


varpage = new ContentPage {Padding = new Thickness(0,20,0,0)};
vars=((((MethodInfo)((TypeInfo)(((TypeInfo)((new AssemblyName("Xamarin.Forms.Xaml, Version=, Culture=neutral, PublicKeyToken=null"))

You can paste it to view the interpreted view of XAML in Xamarin Android Player or iOS Simulator.

After that, the results of editing the XAML portion will be updated immediately.

Note that " must be marked as " for the XAML description here.

Also, how it works is explained in Record of the Fifth Xamarin.Forms War (XAML Live Preview).

2022-09-30 12:06

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.