introduction to xamarin.forms 2.x

33
Craig Dunn @conceptdev Xamarin.Forms 2.x

Upload: craig-dunn

Post on 21-Jan-2017

705 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Introduction to Xamarin.Forms 2.x

Craig Dunn@conceptdev

Xamarin.Forms 2.x

Page 2: Introduction to Xamarin.Forms 2.x

Why Xamarin?

Page 3: Introduction to Xamarin.Forms 2.x

Thousands of iOS and Android APIs

Public web APIs

Backend integrations

Third party libraries

Memory, CPU and network constraints

App Complexity

Page 4: Introduction to Xamarin.Forms 2.x

Write Everything in C#C# Now Runs on 2.6+ Billion

Devices

Page 5: Introduction to Xamarin.Forms 2.x

“With Xamarin, developers combine all of the productivity benefits of C#, Visual Studio and Windows Azure with the flexibility to quickly build for multiple device targets.”

Microsoft and Xamarin

S. Somasegar, Corporate Vice President, Microsoft

Page 6: Introduction to Xamarin.Forms 2.x

Anything you can do in Objective-C, Swift, or Javacan be done in C# and Visual Studio with Xamarin.

Page 7: Introduction to Xamarin.Forms 2.x

Native Performance

Xamarin.iOS does full Ahead Of Time (AOT) compilation to produce an ARM binary for Apple’s App Store.

Xamarin.Android takes advantage of Just In Time (JIT) compilation on the Android device.

Page 8: Introduction to Xamarin.Forms 2.x

Xamarin’s Unique Approach

Shared C# codebase • 100% native API access • High performance

iOS C# UI

Windows C# UIAndroid C# UI

Shared C# Mobile

C# Server

Linux/MonoCoreCLRAzure

Shared C# Client/Server

Page 9: Introduction to Xamarin.Forms 2.x

Code SharingStatsMac

iOS

Android

Windows Phone

iCircuit

Touch Draw

86%

14%

72%

28%

70%

30%

61%

39%

88%

12%

76%

24%

90%

10%

Page 10: Introduction to Xamarin.Forms 2.x

Build native UIs for iOS, Android, Windows, and Windows Phone from a single, shared C# codebase.

Meet Xamarin.Forms

Page 11: Introduction to Xamarin.Forms 2.x

Xamarin + Xamarin.Forms

Traditional Xamarin Approach

With Xamarin.Forms:More code-sharing, all

native

iOS C# UI Windows C#

UIAndroid C# UI

Shared C# Backend

Shared UI Code

Shared C# Backend

Page 12: Introduction to Xamarin.Forms 2.x

What’s included ✓ 40+ Pages, layouts, and controls (Build from code behind or XAML)✓ Two-way data binding✓ Navigation✓ Animation API✓ Dependency Service✓ Messaging Center✓ Effects✓ Templating✓ Windows 10 (UWP) and more to come…

Shared C# Backend

Shared UI Code

Page 13: Introduction to Xamarin.Forms 2.x

<?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>

Native UI from shared code

Page 14: Introduction to Xamarin.Forms 2.x

Layouts

Pages

Stack Absolute Relative Grid ContentView

ScrollView

Frame

Content MasterDetail

Navigation

Tabbed Carousel

Page 15: Introduction to Xamarin.Forms 2.x

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

Page 16: Introduction to Xamarin.Forms 2.x

Other open-source librariesCocosSharp – game engineUrhoSharp – 3D graphics, 2D graphics, & gamesSkiaSharp – 2D graphics

Page 17: Introduction to Xamarin.Forms 2.x

Xamarin.Forms Ecosystem

Page 18: Introduction to Xamarin.Forms 2.x

Xamarin.Forms 2.x

Page 19: Introduction to Xamarin.Forms 2.x

Xamarin.Forms 2.0

✓ XAML compilation✓ Android AppCompat✓ ListViewCachingStrategy✓ PanGestureRecognizer

joins Tap and Pinch ✓ Windows 10 (UWP) Preview in addition to WinRT

Page 20: Introduction to Xamarin.Forms 2.x

XAML Compilation

✓ Surface mark up errors at compile time✓ Improves performance✓ Opt-in (may change)

[assembly:XamlCompilation (XamlCompilationOptions.Compile)]

Page 21: Introduction to Xamarin.Forms 2.x

https://developer.xamarin.com/guides/xamarin-forms/platform-features/android/appcompat/

Android AppCompat

Page 22: Introduction to Xamarin.Forms 2.x

ListViewCachingStrategy

✓ Improves scrolling performance✓ Old behaviour is currently the default (but likely to change)

Page 23: Introduction to Xamarin.Forms 2.x

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

Page 24: Introduction to Xamarin.Forms 2.x

Xamarin.Forms 2.1✓ Control Templates✓ DataTemplateSelector✓ Effects

X BindableProperty.Create<TDeclarer,TPropertyType> has been deprecated

Page 25: Introduction to Xamarin.Forms 2.x

Control Templates I

Page 26: Introduction to Xamarin.Forms 2.x

Control Templates II

Page 27: Introduction to Xamarin.Forms 2.x

Data Templates

Page 28: Introduction to Xamarin.Forms 2.x

Effects I✓ Custom renderer “lite”✓ Change properties on the native control✓ Optional✓ “stringly-typed”

X No methods or eventsX No replacing the control

Page 29: Introduction to Xamarin.Forms 2.x

Effects IIentry.Effects.Add (Effect.Resolve ("Xamarin.BorderEffect"));

Page 30: Introduction to Xamarin.Forms 2.x

Xamarin.Forms vNext

Page 31: Introduction to Xamarin.Forms 2.x

Xamarin – Your Complete Mobile Solution

DESIGN – DEVELOP - INTEGRATE

TEST MONITOR

LEARN

Page 32: Introduction to Xamarin.Forms 2.x

Get Started Todayxamarin.com

Page 33: Introduction to Xamarin.Forms 2.x

Thank You! Questions?Craig Dunn

[email protected]

conceptdev.blogspot.com

@conceptdev