diff options
author | Stephane Delcroix <stephane@delcroix.org> | 2016-09-08 20:45:43 +0200 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-09-08 11:45:43 -0700 |
commit | 3b7d798fdda51a669683ed7d5c3770ebf3adfa77 (patch) | |
tree | 8e4d16d91e9a6cb5a49a8aecf8514a8c84f36b97 /Xamarin.Forms.Controls/GalleryPages | |
parent | 85426c5d9495eb1d55b3128bf97e50c68a73b53f (diff) | |
download | xamarin-forms-3b7d798fdda51a669683ed7d5c3770ebf3adfa77.tar.gz xamarin-forms-3b7d798fdda51a669683ed7d5c3770ebf3adfa77.tar.bz2 xamarin-forms-3b7d798fdda51a669683ed7d5c3770ebf3adfa77.zip |
[Xaml] support native views and native bindings (#266)
Allows including Native views directly in xaml.
Support for ios, android, UWP
Diffstat (limited to 'Xamarin.Forms.Controls/GalleryPages')
-rw-r--r-- | Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml | 14 | ||||
-rw-r--r-- | Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml.cs | 21 |
2 files changed, 35 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml b/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml new file mode 100644 index 00000000..7a1fb850 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + xmlns:ios="clr-namespace:UIKit;assembly=Xamarin.iOS;targetPlatform=iOS" + xmlns:androidWidget="clr-namespace:Android.Widget;assembly=Mono.Android;targetPlatform=Android" + xmlns:formsandroid="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.Platform.Android;targetPlatform=Android" + xmlns:win="clr-namespace:Windows.UI.Xaml.Controls;assembly=Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime;targetPlatform=Windows" + x:Class="Xamarin.Forms.Controls.XamlNativeViews"> + <ContentPage.Content> + <ios:UILabel Text="{Binding NativeText}" View.HorizontalOptions="Start"/> + <androidWidget:TextView Text="{Binding NativeText}" x:Arguments="{x:Static formsandroid:Forms.Context}" /> + <win:TextBlock Text="Foo"/> + </ContentPage.Content> +</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml.cs b/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml.cs new file mode 100644 index 00000000..1e40fdb7 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +namespace Xamarin.Forms.Controls +{ + public partial class XamlNativeViews : ContentPage + { + public XamlNativeViews() + { + InitializeComponent(); + BindingContext = new VM { NativeText = "Text set to Native view using native binding" }; + } + } + + public class VM + { + public string NativeText { get; set; } + } +}
\ No newline at end of file |