SlideShare a Scribd company logo
1 of 35
Download to read offline
Say Hello To Xamarin.Forms
Nish Anil
@nishanil | nish@xamarin.com
Traditional Xamarin Development
Using the Native UI SDKs
■
Build native UIs
■
UIKit & Storyboards on iOS
■
AXML for Android
■
XAML for Windows Phone
■
Write shared C# code
■
Database, Web Services
■
Business Logic
■
Share 60-80% of the code
UIKit Layout XAML
Using Xamarin.Forms
Shared UI Code!
To Build the User Interface
■
Use the same strategies for sharing
■
Database, Web Services
■
Business Logic
■
Build the UI with a single shared
codebase
■
Share 99% of the code
UIKit Layout XAML
Using Xamarin.Forms
Shared UI Code!
■
Code sharing/re-use
■
Native look and feel
■
Access to native SDKs using Custom
Renderers and DependencyService
■
Camera, accelerometer, GPS,
■
NFC & more on Android
■
PassKit & more on iOS
■
Tiles & more on Windows Phone
Benefits UIKit Layout XAML
Shared C# User Interface Code
Meet Xamarin.Forms
Build native UIs for iOS, Android and Windows Phone
from a single, shared C# codebase.
Meet Xamarin.Forms
Build native UIs for iOS, Android and Windows Phone
from a single, shared C# codebase.
Meet Xamarin.Forms
Build native UIs for iOS, Android and Windows Phone
from a single, shared C# codebase.
Meet Xamarin.Forms
Build native UIs for iOS, Android and Windows Phone
from a single, shared C# codebase.
Meet Xamarin.Forms
Build native UIs for iOS, Android and Windows Phone
from a single, shared C# codebase.
Meet Xamarin.Forms
Build native UIs for iOS, Android and Windows Phone
from a single, shared C# codebase.
Meet Xamarin.Forms
public class HelloWorld : ContentPage

{

public HelloWorld ()

{

var button = new Button
{ Text = "Say Hello" } ;

button.Clicked += SayHelloClicked;

Content = new StackLayout {

new Label { Text = "Hello World" } ,

button

};

}
void SayHelloClicked (object s, EventArgs e)

{

// do something

}

}

<?xml version="1.0" encoding="UTF-8"?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/fo
x:Class="HelloForms.HelloWorld">

<StackLayout>

<Label Text="Hello World" />

<Button Text="Say Hello"
OnClick="SayHelloClicked" />

</StackLayout>

</ContentPage>



public partial class HelloWorld : ContentPage
{

public HelloWorld ()
{

InitializeComponent ();

}

void SayHelloClicked (object s, EventArgs e)
{

// do something

}

}
C# XAML
Demo
■
File > New Project
■
Create a screen
■
Add some code
■
Run on iOS, Android, 

& Windows Phone
How Xamarin.Forms works
Anatomy of a Xamarin.Forms Solution
■
PCL or Shared Project
How Xamarin.Forms works
Anatomy of a Xamarin.Forms Solution
■
PCL or Shared Project
■
NuGet Package
How Xamarin.Forms works
Anatomy of a Xamarin.Forms Solution
■
PCL or Shared Project
■
NuGet Package
■
App Class
How Xamarin.Forms works
Anatomy of a Xamarin.Forms Solution
■
PCL or Shared Project
■
NuGet Package
■
App Class
■
Android app
How Xamarin.Forms works
Anatomy of a Xamarin.Forms Solution
■
PCL or Shared Project
■
NuGet Package
■
App Class
■
Android app
■
iOS app
How Xamarin.Forms works
Anatomy of a Xamarin.Forms Solution
■
PCL or Shared Project
■
NuGet Package
■
App Class
■
Android app
■
iOS app
■
Windows Phone app
Platform Renderers
Taking Xamarin.Forms UI to the people (devices)
?
?
?
Platform Renderers
Taking Xamarin.Forms UI to the people
Platform Renderers
Taking Xamarin.Forms UI to the people
Platform Renderers
Taking Xamarin.Forms UI to the people
Xamarin.Forms brings common UX to everyone
iOS does not have a native control
for the iPhone, however
Xamarin.Forms uses
UISplitViewController on iPad.
Android has a native 'drawer'
control which Xamarin.Forms uses.
Windows Phone doesn’t have a
comparable UI metaphor, so
Xamarin.Forms provides an
implementation.
MasterDetailPage
Xamarin.Forms brings common UX to everyone
iOS has the UINavigationController
which Xamarin.Forms leverages.
Android has the navigation stack
built in, but Xamarin.Forms adds
the automatic 'back' button for API
consistency.
Windows Phone also has a back-
stack with hardware button, so
Xamarin.Forms takes advantage of
that.
NavigationPage
140+ new Controls!
http://components.xamarin.com
From our Partners!
Demo
■
Write Platform Specific Code
Dependency Service
Easily call into platform-specific code
■
In the common code
■
Code to an Interface
public interface ITextToSpeech

{

void Speak (string text);

}
Dependency Service
Easily call into platform-specific code
■
In the common code
■
Code to an Interface
■
Use DependencyService
public interface ITextToSpeech

{

void Speak (string text);

}
DependencyService.Get<ITextToSpeech>().Speak("Hello from Xamarin Forms");

Dependency Service
Easily call into platform-specific code
■
In the common code
■
Code to an Interface
■
Use DependencyService
■
For each platform
■
implement the Interface
[assembly: Xamarin.Forms.Dependency (typeof (Speech))]


public class Speech : ITextToSpeech

{

public Speech () { }

public void Speak (string text)

{

var speechSynthesizer = new AVSpeechSynthesizer ();

var speechUtterance = new AVSpeechUtterance (text) {

Rate = AVSpeechUtterance.MaximumSpeechRate/4,

Voice = AVSpeechSynthesisVoice.FromLanguage ("en-US"),

Volume = 0.5f,

PitchMultiplier = 1.0f

} ;

speechSynthesizer.SpeakUtterance (speechUtterance);

}

}
Dependency Service
Easily call into platform-specific code
■
In the common code
■
Code to an Interface
■
Use DependencyService
■
For each platform
■
implement the Interface
■
use Dependency
attribute on the
assembly
[assembly: Xamarin.Forms.Dependency (typeof (Speech))]


public class Speech : ITextToSpeech

{

public Speech () { }

public void Speak (string text)

{

var speechSynthesizer = new AVSpeechSynthesizer ();

var speechUtterance = new AVSpeechUtterance (text) {

Rate = AVSpeechUtterance.MaximumSpeechRate/4,

Voice = AVSpeechSynthesisVoice.FromLanguage ("en-US"),

Volume = 0.5f,

PitchMultiplier = 1.0f

} ;

speechSynthesizer.SpeakUtterance (speechUtterance);

}

}
Data Binding
Sync views and models
■
Enables MVVM-style development
■
SetBinding in C#
■
{Binding} in XAML
■
also supports the Command pattern
Custom Renderers
Extend or Create Xamarin.Forms Controls
■
Subclass the built-in Platform Renderers
■
Build your own Xamarin.Forms

control and renderers

(eg. OxyPlot)
Further Reading…
■
developer.xamarin.com
■
forums.xamarin.com
■
Creating Mobile Apps with
Xamarin.Forms - Charles Petzold

Available as a FREE download
Thanks!
Nish Anil
@nishanil | nish@xamarin.com

More Related Content

What's hot

Mobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with XamarinMobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with Xamarin
Nick Landry
 

What's hot (20)

An introduction to Xamarin
An introduction to XamarinAn introduction to Xamarin
An introduction to Xamarin
 
Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4Native i os, android, and windows development in c# with xamarin 4
Native i os, android, and windows development in c# with xamarin 4
 
Xamarin overview droidcon.tn
Xamarin overview   droidcon.tnXamarin overview   droidcon.tn
Xamarin overview droidcon.tn
 
Introduction to Mobile Development with Xamarin -DotNet Westide
Introduction to Mobile Development with Xamarin -DotNet WestideIntroduction to Mobile Development with Xamarin -DotNet Westide
Introduction to Mobile Development with Xamarin -DotNet Westide
 
Customizing Xamarin.Forms UI
Customizing Xamarin.Forms UICustomizing Xamarin.Forms UI
Customizing Xamarin.Forms UI
 
Native iOS and Android Development with Xamarin
Native iOS and Android Development with XamarinNative iOS and Android Development with Xamarin
Native iOS and Android Development with Xamarin
 
Dotnetconf - Introduction to Xamarin and Xamarin.Forms
Dotnetconf - Introduction to Xamarin and Xamarin.FormsDotnetconf - Introduction to Xamarin and Xamarin.Forms
Dotnetconf - Introduction to Xamarin and Xamarin.Forms
 
Cross Platform Mobile Development with C# and Xamarin
Cross Platform Mobile Development with C# and XamarinCross Platform Mobile Development with C# and Xamarin
Cross Platform Mobile Development with C# and Xamarin
 
Xamarin Forms
Xamarin FormsXamarin Forms
Xamarin Forms
 
Xamarin Overview by Houssem Dellai
Xamarin Overview by Houssem DellaiXamarin Overview by Houssem Dellai
Xamarin Overview by Houssem Dellai
 
Xamarin cross platform
Xamarin cross platformXamarin cross platform
Xamarin cross platform
 
Introduction to xamarin
Introduction to xamarinIntroduction to xamarin
Introduction to xamarin
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
 
Highlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conferenceHighlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conference
 
Getting Started with iOS & Android Development Using Xamarin & Visual Studio
Getting Started with iOS & Android Development Using Xamarin & Visual StudioGetting Started with iOS & Android Development Using Xamarin & Visual Studio
Getting Started with iOS & Android Development Using Xamarin & Visual Studio
 
Building Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual StudioBuilding Your First iOS App with Xamarin for Visual Studio
Building Your First iOS App with Xamarin for Visual Studio
 
Mobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with XamarinMobile Cross-Platform App Development in C# with Xamarin
Mobile Cross-Platform App Development in C# with Xamarin
 
Xamarin.Forms
Xamarin.FormsXamarin.Forms
Xamarin.Forms
 
Xamarin Cross-Platform with Xamarin.Form, MvvmCross
Xamarin Cross-Platform with Xamarin.Form, MvvmCrossXamarin Cross-Platform with Xamarin.Form, MvvmCross
Xamarin Cross-Platform with Xamarin.Form, MvvmCross
 
Cross Platform Development with Xamarin
Cross Platform Development with XamarinCross Platform Development with Xamarin
Cross Platform Development with Xamarin
 

Viewers also liked

Building mvvm & single pageapps in js
Building mvvm & single pageapps in jsBuilding mvvm & single pageapps in js
Building mvvm & single pageapps in js
Nish Anil
 
Presentación paisajes sonoros c
Presentación paisajes sonoros cPresentación paisajes sonoros c
Presentación paisajes sonoros c
iscdm17
 

Viewers also liked (13)

Building mvvm & single pageapps in js
Building mvvm & single pageapps in jsBuilding mvvm & single pageapps in js
Building mvvm & single pageapps in js
 
Programming iOS in C#
Programming iOS in C#Programming iOS in C#
Programming iOS in C#
 
Xamarin ile Android Uygulama
Xamarin ile Android UygulamaXamarin ile Android Uygulama
Xamarin ile Android Uygulama
 
Apple Watch Intro
Apple Watch IntroApple Watch Intro
Apple Watch Intro
 
Presentación paisajes sonoros c
Presentación paisajes sonoros cPresentación paisajes sonoros c
Presentación paisajes sonoros c
 
Wearables with C# and Xamarin
Wearables with C# and XamarinWearables with C# and Xamarin
Wearables with C# and Xamarin
 
Functional GUIs with F#
Functional GUIs with F#Functional GUIs with F#
Functional GUIs with F#
 
Adding Intelligence To Your Mobile Apps
Adding Intelligence To Your Mobile AppsAdding Intelligence To Your Mobile Apps
Adding Intelligence To Your Mobile Apps
 
用20分鐘搞懂 《系統分析、軟體工程、專案管理與設計模式》
用20分鐘搞懂   《系統分析、軟體工程、專案管理與設計模式》用20分鐘搞懂   《系統分析、軟體工程、專案管理與設計模式》
用20分鐘搞懂 《系統分析、軟體工程、專案管理與設計模式》
 
HDFS Namenode High Availability
HDFS Namenode High AvailabilityHDFS Namenode High Availability
HDFS Namenode High Availability
 
Introduction to Xamarin.Forms
Introduction to Xamarin.FormsIntroduction to Xamarin.Forms
Introduction to Xamarin.Forms
 
Recommender Systems with Ruby (adding machine learning, statistics, etc)
Recommender Systems with Ruby (adding machine learning, statistics, etc)Recommender Systems with Ruby (adding machine learning, statistics, etc)
Recommender Systems with Ruby (adding machine learning, statistics, etc)
 
Introduction to angular 2
Introduction to angular 2Introduction to angular 2
Introduction to angular 2
 

Similar to APAC Webinar: Say Hello To Xamarin.Forms

Building Mobile Cross-Platform Apps for iOS, Android & Windows in C# with Xam...
Building Mobile Cross-Platform Apps foriOS, Android & Windows in C# with Xam...Building Mobile Cross-Platform Apps foriOS, Android & Windows in C# with Xam...
Building Mobile Cross-Platform Apps for iOS, Android & Windows in C# with Xam...
Nick Landry
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
NAVER D2
 

Similar to APAC Webinar: Say Hello To Xamarin.Forms (20)

Your First Xamarin.Forms App
Your First Xamarin.Forms AppYour First Xamarin.Forms App
Your First Xamarin.Forms App
 
Introduction to Xamarin - Confoo 2015
Introduction to Xamarin - Confoo 2015Introduction to Xamarin - Confoo 2015
Introduction to Xamarin - Confoo 2015
 
Introduction to Xamarin.Forms
Introduction to Xamarin.FormsIntroduction to Xamarin.Forms
Introduction to Xamarin.Forms
 
App innovationcircles xamarin
App innovationcircles xamarinApp innovationcircles xamarin
App innovationcircles xamarin
 
Windows und Windows Phone App Entwicklung (Daniel Meixner, DWX 2014)
Windows und Windows Phone App Entwicklung (Daniel Meixner, DWX 2014)Windows und Windows Phone App Entwicklung (Daniel Meixner, DWX 2014)
Windows und Windows Phone App Entwicklung (Daniel Meixner, DWX 2014)
 
State of Union: Xamarin & Cross-Platform .NET in 2016 and Beyond
State of Union: Xamarin & Cross-Platform .NET in 2016 and BeyondState of Union: Xamarin & Cross-Platform .NET in 2016 and Beyond
State of Union: Xamarin & Cross-Platform .NET in 2016 and Beyond
 
20141216 멜팅팟 부산 세션 ii - cross platform 개발
20141216 멜팅팟 부산   세션 ii - cross platform 개발20141216 멜팅팟 부산   세션 ii - cross platform 개발
20141216 멜팅팟 부산 세션 ii - cross platform 개발
 
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
Tips & tricks for sharing C# code on iOS, Android and Windows Phone by Jaime ...
 
Cross platform mobile app development with Xamarin
Cross platform mobile app development with XamarinCross platform mobile app development with Xamarin
Cross platform mobile app development with Xamarin
 
20150812 4시간만에 따라해보는 windows 10 앱 개발
20150812  4시간만에 따라해보는 windows 10 앱 개발20150812  4시간만에 따라해보는 windows 10 앱 개발
20150812 4시간만에 따라해보는 windows 10 앱 개발
 
Xamarin Dev Days - Introduction to Xamarin.Forms, Insights, Test Cloud
Xamarin Dev Days -  Introduction to Xamarin.Forms, Insights, Test CloudXamarin Dev Days -  Introduction to Xamarin.Forms, Insights, Test Cloud
Xamarin Dev Days - Introduction to Xamarin.Forms, Insights, Test Cloud
 
Building Mobile Cross-Platform Apps for iOS, Android & Windows in C# with Xam...
Building Mobile Cross-Platform Apps foriOS, Android & Windows in C# with Xam...Building Mobile Cross-Platform Apps foriOS, Android & Windows in C# with Xam...
Building Mobile Cross-Platform Apps for iOS, Android & Windows in C# with Xam...
 
WebAssembly and .NET
WebAssembly and .NETWebAssembly and .NET
WebAssembly and .NET
 
Cross Platform Mobile Development
Cross Platform Mobile DevelopmentCross Platform Mobile Development
Cross Platform Mobile Development
 
Cross platform mobile app development tools review
Cross platform mobile app development tools reviewCross platform mobile app development tools review
Cross platform mobile app development tools review
 
Xamarin Platform
Xamarin PlatformXamarin Platform
Xamarin Platform
 
Introduction to Xamarin.Forms
Introduction to Xamarin.FormsIntroduction to Xamarin.Forms
Introduction to Xamarin.Forms
 
Titanium #MDS13
Titanium #MDS13Titanium #MDS13
Titanium #MDS13
 
Going Mobile with C#, Visual Studio, and Xamarin
Going Mobile with C#, Visual Studio, and XamarinGoing Mobile with C#, Visual Studio, and Xamarin
Going Mobile with C#, Visual Studio, and Xamarin
 
(Christian heilman) firefox
(Christian heilman) firefox(Christian heilman) firefox
(Christian heilman) firefox
 

More from Nish Anil (6)

[MobConf] Programming wearables in c#
[MobConf] Programming wearables in c#[MobConf] Programming wearables in c#
[MobConf] Programming wearables in c#
 
[Bdotnet] Cloud connected mobile apps
[Bdotnet] Cloud connected mobile apps[Bdotnet] Cloud connected mobile apps
[Bdotnet] Cloud connected mobile apps
 
Evolve recap XHackers, Bangalore
Evolve recap XHackers, BangaloreEvolve recap XHackers, Bangalore
Evolve recap XHackers, Bangalore
 
Building databound JavaScript apps with Knockoutjs
Building databound JavaScript apps with KnockoutjsBuilding databound JavaScript apps with Knockoutjs
Building databound JavaScript apps with Knockoutjs
 
Using mvvm on the web using knockoutjs & ignite ui
Using mvvm on the web using knockoutjs & ignite uiUsing mvvm on the web using knockoutjs & ignite ui
Using mvvm on the web using knockoutjs & ignite ui
 
Infragistics: Getting Started with MVVM in WPF & Silverlight
Infragistics: Getting Started with MVVM in WPF & SilverlightInfragistics: Getting Started with MVVM in WPF & Silverlight
Infragistics: Getting Started with MVVM in WPF & Silverlight
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 

APAC Webinar: Say Hello To Xamarin.Forms

  • 1. Say Hello To Xamarin.Forms Nish Anil @nishanil | nish@xamarin.com
  • 2. Traditional Xamarin Development Using the Native UI SDKs ■ Build native UIs ■ UIKit & Storyboards on iOS ■ AXML for Android ■ XAML for Windows Phone ■ Write shared C# code ■ Database, Web Services ■ Business Logic ■ Share 60-80% of the code UIKit Layout XAML
  • 3. Using Xamarin.Forms Shared UI Code! To Build the User Interface ■ Use the same strategies for sharing ■ Database, Web Services ■ Business Logic ■ Build the UI with a single shared codebase ■ Share 99% of the code UIKit Layout XAML
  • 4. Using Xamarin.Forms Shared UI Code! ■ Code sharing/re-use ■ Native look and feel ■ Access to native SDKs using Custom Renderers and DependencyService ■ Camera, accelerometer, GPS, ■ NFC & more on Android ■ PassKit & more on iOS ■ Tiles & more on Windows Phone Benefits UIKit Layout XAML Shared C# User Interface Code
  • 5. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  • 6. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  • 7. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  • 8. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  • 9. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  • 10. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  • 11. Meet Xamarin.Forms public class HelloWorld : ContentPage
 {
 public HelloWorld ()
 {
 var button = new Button { Text = "Say Hello" } ;
 button.Clicked += SayHelloClicked;
 Content = new StackLayout {
 new Label { Text = "Hello World" } ,
 button
 };
 } void SayHelloClicked (object s, EventArgs e)
 {
 // do something
 }
 }
 <?xml version="1.0" encoding="UTF-8"?>
 <ContentPage xmlns="http://xamarin.com/schemas/2014/fo x:Class="HelloForms.HelloWorld">
 <StackLayout>
 <Label Text="Hello World" />
 <Button Text="Say Hello" OnClick="SayHelloClicked" />
 </StackLayout>
 </ContentPage>
 
 public partial class HelloWorld : ContentPage {
 public HelloWorld () {
 InitializeComponent ();
 }
 void SayHelloClicked (object s, EventArgs e) {
 // do something
 }
 } C# XAML
  • 12. Demo ■ File > New Project ■ Create a screen ■ Add some code ■ Run on iOS, Android, 
 & Windows Phone
  • 13.
  • 14. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project
  • 15. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project ■ NuGet Package
  • 16. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project ■ NuGet Package ■ App Class
  • 17. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project ■ NuGet Package ■ App Class ■ Android app
  • 18. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project ■ NuGet Package ■ App Class ■ Android app ■ iOS app
  • 19. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project ■ NuGet Package ■ App Class ■ Android app ■ iOS app ■ Windows Phone app
  • 20. Platform Renderers Taking Xamarin.Forms UI to the people (devices) ? ? ?
  • 24. Xamarin.Forms brings common UX to everyone iOS does not have a native control for the iPhone, however Xamarin.Forms uses UISplitViewController on iPad. Android has a native 'drawer' control which Xamarin.Forms uses. Windows Phone doesn’t have a comparable UI metaphor, so Xamarin.Forms provides an implementation. MasterDetailPage
  • 25. Xamarin.Forms brings common UX to everyone iOS has the UINavigationController which Xamarin.Forms leverages. Android has the navigation stack built in, but Xamarin.Forms adds the automatic 'back' button for API consistency. Windows Phone also has a back- stack with hardware button, so Xamarin.Forms takes advantage of that. NavigationPage
  • 28. Dependency Service Easily call into platform-specific code ■ In the common code ■ Code to an Interface public interface ITextToSpeech
 {
 void Speak (string text);
 }
  • 29. Dependency Service Easily call into platform-specific code ■ In the common code ■ Code to an Interface ■ Use DependencyService public interface ITextToSpeech
 {
 void Speak (string text);
 } DependencyService.Get<ITextToSpeech>().Speak("Hello from Xamarin Forms");

  • 30. Dependency Service Easily call into platform-specific code ■ In the common code ■ Code to an Interface ■ Use DependencyService ■ For each platform ■ implement the Interface [assembly: Xamarin.Forms.Dependency (typeof (Speech))] 
 public class Speech : ITextToSpeech
 {
 public Speech () { }
 public void Speak (string text)
 {
 var speechSynthesizer = new AVSpeechSynthesizer ();
 var speechUtterance = new AVSpeechUtterance (text) {
 Rate = AVSpeechUtterance.MaximumSpeechRate/4,
 Voice = AVSpeechSynthesisVoice.FromLanguage ("en-US"),
 Volume = 0.5f,
 PitchMultiplier = 1.0f
 } ;
 speechSynthesizer.SpeakUtterance (speechUtterance);
 }
 }
  • 31. Dependency Service Easily call into platform-specific code ■ In the common code ■ Code to an Interface ■ Use DependencyService ■ For each platform ■ implement the Interface ■ use Dependency attribute on the assembly [assembly: Xamarin.Forms.Dependency (typeof (Speech))] 
 public class Speech : ITextToSpeech
 {
 public Speech () { }
 public void Speak (string text)
 {
 var speechSynthesizer = new AVSpeechSynthesizer ();
 var speechUtterance = new AVSpeechUtterance (text) {
 Rate = AVSpeechUtterance.MaximumSpeechRate/4,
 Voice = AVSpeechSynthesisVoice.FromLanguage ("en-US"),
 Volume = 0.5f,
 PitchMultiplier = 1.0f
 } ;
 speechSynthesizer.SpeakUtterance (speechUtterance);
 }
 }
  • 32. Data Binding Sync views and models ■ Enables MVVM-style development ■ SetBinding in C# ■ {Binding} in XAML ■ also supports the Command pattern
  • 33. Custom Renderers Extend or Create Xamarin.Forms Controls ■ Subclass the built-in Platform Renderers ■ Build your own Xamarin.Forms
 control and renderers
 (eg. OxyPlot)
  • 34. Further Reading… ■ developer.xamarin.com ■ forums.xamarin.com ■ Creating Mobile Apps with Xamarin.Forms - Charles Petzold
 Available as a FREE download
  • 35. Thanks! Nish Anil @nishanil | nish@xamarin.com