Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xaml] Support native view declaration in Xaml #266

Merged
merged 1 commit into from Sep 8, 2016
Merged

Conversation

StephaneDelcroix
Copy link
Member

@StephaneDelcroix StephaneDelcroix commented Jul 25, 2016

Description of Change

With this PR, the following Xaml is valid, and works as expected:

<?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:android="clr-namespace:Android.Views;assembly=Mono.Android;targetPlatform=Android"
             x:Class="Xamarin.Forms.Controls.XamlNativeViews">
    <ContentPage.Content>
        <ios:UILabel Text="I'm Native" />
        <android:TextView  Text="I'm Native too" />
    </ContentPage.Content>
</ContentPage>

That means 2 things:

  • native views are automagically wrapped into the appropriate wrapper
  • xmlns defined on a non-matching targetPlatform (see TargetPlatform enumeration) are ignored

Bugs Fixed

None

API Changes

None

Behavioral Changes

None

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense

@StephaneDelcroix
Copy link
Member Author

StephaneDelcroix commented Jul 25, 2016

Do NOT merge yet for the following reasons:

  • It doesn't work as expected as there's a bug in our implementation of mc:Ignorable
  • missing implementation for Android
  • missing implementation for Windows

else
{
}
else {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change in this, unnecessary diff

@StephaneDelcroix StephaneDelcroix force-pushed the xaml-nativeview branch 3 times, most recently from 7e8d5f2 to ef35a36 Compare August 11, 2016 12:17
@StephaneDelcroix StephaneDelcroix force-pushed the xaml-nativeview branch 2 times, most recently from 23e2832 to e4ef5ed Compare August 14, 2016 14:43
@StephaneDelcroix StephaneDelcroix force-pushed the xaml-nativeview branch 6 times, most recently from 37a9fef to 6703f77 Compare September 2, 2016 08:37
@StephaneDelcroix
Copy link
Member Author

If you review this, review only the 2nd commit. the first is part of another PR

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"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notice the targetPlatform on these 4 lines. notice the cumbersome assembly name for uwp as well, but that's required to get it working

Allows including Native views directly in xaml.
Support for ios, android, UWP
@jassmith jassmith merged commit 3b7d798 into master Sep 8, 2016
rmarinho pushed a commit that referenced this pull request Sep 13, 2016
Allows including Native views directly in xaml.
Support for ios, android, UWP
@StephaneDelcroix StephaneDelcroix deleted the xaml-nativeview branch January 31, 2017 20:05
@samhouts samhouts added this to the 2.3.3 milestone Jun 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants