42
#XamarinDevDays

Xamarin.forms

Embed Size (px)

Citation preview

PowerPoint Presentation

#XamarinDevDays

Alexandre [email protected] Forms

Cross-Platform Native User Interfaceswith Xamarin.FormsXamarinDevDays Lisbon24-09-2016

@alexmarreirosDigitalmindignition.comAboutAlexandre MarreirosWindows Platform Development Microsoft MVPMicrosoft Windows DevCamp TrainerWindows InsiderCTO @ InnovagencySoftware Dev/Arch as IndependentTechnical Trainer and Speaker as IndependentTeacher @ EDITTechnical Writer

@alexmarreirosDigitalmindignition.comAboutAlexandre Marreiros

Different User Interface Paradigms

Different development Enviroments

Diferent Programming languages

Diferent Visual Objects

Diferent App Lifecycles

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

Xamarin + Xamarin.FormsTraditional Xamarin ApproachWith Xamarin.Forms:More code-sharing, all native iOS C# UI Windows C# UIAndroid C# UI

Shared C# Backend

Shared UI CodeShared C# Backend

Whats included 40+ Pages, layouts, and controls (Build from code behind or XAML) Two-way data binding Navigation Animation API Dependency Service Messaging Center

Shared C# Backend

Shared UI Code

11

In detailIOS APPAndroid APPWindows AppShared Asset Project and Portable Class Library

Xamarin.Forms.Core and Xamarin.Forms.Xaml

12

In detailXamrin.Forms.Platform.IOSXamrin.Forms.Platform.AndroidXamarin.Platform.WindowsXamarin.Forms.Core and Xamarin.Forms.Xaml

Xamarin.IOSXamarin.AndroidIOS APIAndroid APIWindows API

Mono Toutch Core

13

In detailVisual ElementsPageLayoutViewScreenOrganizationControls / Widgets

Organized in a Parent Child Relation

14

LayoutsPagesStackAbsoluteRelativeGridContentViewScrollViewFrame

ContentMasterDetailNavigationTabbedCarousel

Inside of a page are layoutsA lot of options from something simple like a stack panel to complex and powerful grids

15

ActivityIndicatorBoxViewButtonDatePickerEditorEntryImageLabelListViewMapOpenGLViewPickerProgressBarSearchBarSliderStepperTableViewTimePickerWebViewEntryCellImageCellSwitchCellTextCellViewCellControls

You have more than 40 controls, layouts, and pages to mix and match from.These are all of the controls you have out of the box, you can of course create your own.What is unique is you get the native control and have access to it.Consider an Entry FieldOn iOS it is mapped to UITextFieldAndroid it is EditTextWindows Phoen it is a TextBox16

Xamarin.Forms Ecosystem

WindowsXamarin.FormsStackPanelStackLayoutTextBoxEntryListBoxListViewCheckBoxSwitchProgressBarActivityIndicatorGridGridLabelLabelButtonButtonImageImageDate/TimePickerDate/TimePicker

Control Comparison

18

WindowsXamarin.FormsDataContextBindingContext{Binding Property}{Binding Property}ItemsSourceItemsSourceItemTemplateItemTemplateDataTemplateDataTemplate

BindingComparison

19

PlatformCustomization

20

Native UI from shared code

Xamarin.Forms

Demo

Whats new?

Xamarin.Forms 2.0!

Xamarin.Formsis Open Source!open.xamarin.com

Apple has a developer preview where Xamarin has alphas ready. Google does not offer this. Android versions are usually 4 to 8 weeks out for a stable release, but alphas and betas are usually earlier. Xamarin realizes how important having iOS ready because within 24 hours a large portion of iOS users upgradeAndroid on the other hand is much different. After 4 months on the market Android 4.4 only had 1% adoption

24

PerformancePerformancePerformance

ListView CachingStrategy

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

XAML CompilationXAML

RuntimeCompile-timeParsed and inflatedParsed & turned into IL

XAMLC

Benefits Faster Loading Smaller App Size See XAML errors at build time

Design & Controls

Data Templates

CarouselViewEmbeddable CarouselItemTemplate & DataTemplatesHighly customizable & Virtualized

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

X No methods or eventsX No replacing the control

A unique aspect of Xamarin.Forms is an abstraction over the user interface, but what about the platform specific functionality that makes these devices so special?

That is where plugins for Xamarin come in.32

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

A unique aspect of Xamarin.Forms is an abstraction over the user interface, but what about the platform specific functionality that makes these devices so special?

That is where plugins for Xamarin come in.33

So much more

XAML Previewer

URL Navigation

Connect Web to MobileSimple cross platform API over:CoreSpotlightNSUserActivityGoogle App Indexing

DataPages

https://developer.xamarin.com/guides/xamarin-forms/datapages/

Themes

https://developer.xamarin.com/guides/xamarin-forms/themes/

Native Embedding

Easily embed any native control into a Xamarin.Forms layout.

Native Embedding

Just add it as child to a layout.Exposed as an Extension Method.

The slides are yours

2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.9/23/201641

20 Minute Break

2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.9/24/201642