what's new in xamarin.forms?
TRANSCRIPT
What’s new in Xamarin.Forms?
James Montemagno @JamesMontemagno
Who’s this guy?
JamesMontemagnoDeveloper Evangelist, Xamarin
[email protected] motzcod.es @JamesMontemagno
Xamarin’s Unique Approach
SharedC#codebase•100%nativeAPIaccess•Highperformance
iOSC#UI WindowsC#UIAndroidC#UI
SharedC#Logic
Windows APIs
Microsoft.Phone Microsoft.Networking Windows.Storage Windows.Foundation Microsoft.Devices
System.Data System.Windows System.Numerics System.Core System.ServiceModel
System.Net System System.IO System.Linq System.Xml
iOS – 100% API Coverage
MapKit UIKit iBeacon CoreGraphics CoreMotion
System.Data System.Windows System.Numerics System.Core System.ServiceModel
System.Net System System.IO System.Linq System.Xml
Android – 100% API Coverage
Text-to-speech ActionBar PrintingFramework Renderscript NFC
System.Data System.Windows System.Numerics System.Core System.ServiceModel
System.Net System System.IO System.Linq System.Xml
Native Performance
Xamarin.iOS doesfullAheadOfTime(AOT)compilationtoproduceanARMbinaryforApple’sAppStore.
Xamarin.Android takesadvantageofJustInTime(JIT)compilationontheAndroiddevice.
WriteEverythinginC#C#NowRunson2.6+BillionDevices
✓Always Up-to-Date
Same-day support:• iOS 5• iOS 6• iOS 7• iOS 7.1• iOS 8• iOS 9
Full support for:• Apple Watch• Google Glass• Android Wear• Amazon Fire TV• and much more
Visual Studio Xamarin Studio
Anything you can do in Objective-C, Swift, or Javacan be done inC#andVisualStudiowithXamarin.
Xamarin Platform is included
with Visual Studio!
Xamarin Platform is Open Source!
open.xamarin.com
Meet Xamarin.Forms
Build native UIs for iOS, Android, and Windows from a single, shared C# codebase.
Xamarin + Xamarin.Forms
TraditionalXamarinApproach WithXamarin.Forms:More code-sharing, all native
iOSC#UI WindowsC#UIAndroidC#UI
SharedC#Logic
Xamarin.Forms
SharedC#Logic
What’s included
✓ 40+Pages,layouts,andcontrols(BuildfromcodebehindorXAML)
✓ Two-waydatabinding
✓ Navigation
✓ AnimationAPI
✓ DependencyService
✓ MessagingCenter
SharedC#Logic
SharedUICode
Layouts - Pages
Stack Absolute Relative Grid ContentView ScrollView Frame
Content MasterDetail Navigation Tabbed Carousel
ActivityIndicator BoxView Button DatePicker Editor
Entry Image Label ListView Map
OpenGLView Picker ProgressBar SearchBar Slider
Stepper TableView TimePicker WebView EntryCell
ImageCell SwitchCell TextCell ViewCell
Controls
Xamarin.Forms Ecosystem
Native UI from shared code<?xml version="1.0" encoding="UTF-8"?><TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"x:Class="MyApp.MainPage">
<TabbedPage.Children><ContentPage Title="Profile" Icon="Profile.png">
<StackLayout Spacing="20" Padding="20"VerticalOptions="Center">
<Entry Placeholder="Username"Text="{Binding Username}"/>
<Entry Placeholder="Password"Text="{Binding Password}"IsPassword="true"/>
<Button Text="Login" TextColor="White"BackgroundColor="#77D065"Command="{Binding LoginCommand}"/>
</StackLayout></ContentPage><ContentPage Title="Settings" Icon="Settings.png">
<!-- Settings --></ContentPage></TabbedPage.Children>
Xamarin.Forms 2.0✓ XAML compilation✓ Android AppCompat✓ ListViewCachingStrategy✓ PanGestureRecognizer
joins Tap and Pinch J✓Windows 10 (UWP) Preview in addition to WinRT
XAML Compilation✓ Surface mark up errors at compile time✓ Improves performance✓ Opt-in (may change)
[assembly:XamlCompilation (XamlCompilationOptions.Compile)]
AppCompat.Forms
• Same theme• Same attributes• New Activity Base• FormsAppCompatActivity
• 2 new resources• Tabs & Toolbar
https://developer.xamarin.com/guides/xamarin-forms/platform-features/android/appcompat/
Android AppCompat
ListViewCachingStrategy
✓ Improves scrolling performance✓ Old behavior is currently the default (but likely to change)
Windows Support✓WinRT APIs for Windows Phone 8.1✓WinRT APIs for Windows 8.1✓ Universal Windows Platform for Windows 10
X Windows Phone 8 (Silverlight) will be deprecated
2.0! Go!
Xamarin.Forms 2.1✓ Control Templates✓ DataTemplateSelector✓ Effects
X BindableProperty.Create<TDeclarer,TPropertyType> has been deprecated
Control Templates I
Control Templates II
Data Templates
Data Templates
Effects I✓ Custom renderer “lite”✓ Change properties on the native control✓ Optional✓ “stringly-typed”
X No methods or eventsX No replacing the control
Effects IIentry.Effects.Add (Effect.Resolve("Xamarin.BorderEffect"));
2.1! Go!
Xamarin.Forms 2.2✓ Maintenance Release✓ Google Play Services / Support Libraries✓ Margins✓ UWP Maps✓ 2D ScrollView Support✓ CarouselView
XAML Previewer
URL Navigation
DataPages
https://developer.xamarin.com/guides/xamarin-forms/datapages/
Themes
https://developer.xamarin.com/guides/xamarin-forms/themes/
Native Embedding
2.3! Go!
Resources
• Xamarin.Forms Documentation• https://developer.xamarin.com/guides/xamarin-forms/
• Xamarin.Forms Book by Charles Petzold• http://bit.ly/xamarin-forms-book
• Evolve 2016 App • http://github.com/XamarinHQ/app-evolve