summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls
diff options
context:
space:
mode:
authorStephane Delcroix <stephane@delcroix.org>2016-09-08 20:45:43 +0200
committerJason Smith <jason.smith@xamarin.com>2016-09-08 11:45:43 -0700
commit3b7d798fdda51a669683ed7d5c3770ebf3adfa77 (patch)
tree8e4d16d91e9a6cb5a49a8aecf8514a8c84f36b97 /Xamarin.Forms.Controls
parent85426c5d9495eb1d55b3128bf97e50c68a73b53f (diff)
downloadxamarin-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')
-rw-r--r--Xamarin.Forms.Controls/CoreGallery.cs1
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml14
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/XamlNativeViews.xaml.cs21
-rw-r--r--Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj8
4 files changed, 43 insertions, 1 deletions
diff --git a/Xamarin.Forms.Controls/CoreGallery.cs b/Xamarin.Forms.Controls/CoreGallery.cs
index 06f214b4..a7743400 100644
--- a/Xamarin.Forms.Controls/CoreGallery.cs
+++ b/Xamarin.Forms.Controls/CoreGallery.cs
@@ -222,6 +222,7 @@ namespace Xamarin.Forms.Controls
var pages = new List<Page> {
new PlatformSpecificsGallery() {Title = "Platform Specifics"},
new NativeBindingGalleryPage {Title = "Native Binding Controls Gallery"},
+ new XamlNativeViews {Title = "Xaml Native Views Gallery"},
new AppLinkPageGallery {Title = "App Link Page Gallery"},
new NestedNativeControlGalleryPage {Title = "Nested Native Controls Gallery"},
new CellForceUpdateSizeGalleryPage {Title = "Cell Force Update Size Gallery"},
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
diff --git a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
index 3b02adbe..7ad923e0 100644
--- a/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
+++ b/Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
@@ -236,6 +236,9 @@
<Compile Include="ControlGalleryPages\AutomationIDGallery.cs" />
<Compile Include="GalleryPages\AppLinkPageGallery.cs" />
<Compile Include="ControlGalleryPages\NativeBindingGalleryPage.cs" />
+ <Compile Include="GalleryPages\XamlNativeViews.xaml.cs">
+ <DependentUpon>XamlNativeViews.xaml</DependentUpon>
+ </Compile>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\.nuspec\Xamarin.Forms.targets" />
@@ -257,6 +260,9 @@
<EmbeddedResource Include="GalleryPages\StyleXamlGallery.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="GalleryPages\XamlNativeViews.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
</ItemGroup>
<Import Project="..\Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems" Label="Shared" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
@@ -308,4 +314,4 @@
</CreateItem>
<Copy SourceFiles="@(ConfigFile)" DestinationFiles="controlgallery.config" Condition="!Exists('controlgallery.config')" />
</Target>
-</Project> \ No newline at end of file
+</Project>