Created
December 4, 2014 13:03
-
-
Save muojp/4f28cbc8bf5f64ed7684 to your computer and use it in GitHub Desktop.
Sketching w/ Xamarin.Forms XAML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Xamarin.Forms; | |
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using Xamarin.Forms.Xaml; | |
var xaml = @"<?xml version=""1.0"" encoding=""utf-8"" ?> | |
<ContentPage xmlns=""http://xamarin.com/schemas/2014/forms"" | |
xmlns:x=""http://schemas.microsoft.com/winfx/2009/xaml"" | |
x:Class=""XamlSamples.HelloXamlPage"" | |
Title=""Hello XAML Page"" | |
Padding=""10, 40, 10, 10""> | |
<Label Text=""Hello, XAML Sketch!!"" | |
VerticalOptions=""Start"" | |
XAlign=""Center"" | |
Rotation=""15"" | |
IsVisible=""true"" | |
Font=""Bold, 80"" | |
TextColor=""Red"" /> | |
</ContentPage>"; | |
var page = new ContentPage{Padding = new Thickness(0,20,0,0)}; | |
var s = ( | |
((MethodInfo)( | |
((TypeInfo)( | |
(Assembly.Load(new AssemblyName("Xamarin.Forms.Xaml, Version=1.2.3.0, Culture=neutral, PublicKeyToken=null")) | |
.GetTypes() | |
.Where(t => t.FullName == "Xamarin.Forms.Xaml.Extensions") | |
.First() | |
) | |
)).DeclaredMembers | |
.Where(t => !((MethodInfo)t).Attributes.HasFlag(System.Reflection.MethodAttributes.Family)) | |
.First() | |
)).MakeGenericMethod(typeof(ContentPage)) | |
).Invoke(null, new object[]{page, xaml}) != null; | |
RootPage.Children.Add(page); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment