Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

APAC Webinar: Say Hello To Xamarin.Forms

17,717 views

Published on

Xamarin Webinar on Say Hello to Xamarin.Forms

Published in: Technology
  • Dating for everyone is here: ❶❶❶ http://bit.ly/39sFWPG ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ♥♥♥ http://bit.ly/39sFWPG ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • HOW TO UNLOCK HER LEGS! (SNEAK PEAK), learn more... ♥♥♥ http://scamcb.com/unlockher/pdf
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

APAC Webinar: Say Hello To Xamarin.Forms

  1. 1. Say Hello To Xamarin.Forms Nish Anil @nishanil | nish@xamarin.com
  2. 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. 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. 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. 5. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  6. 6. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  7. 7. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  8. 8. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  9. 9. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  10. 10. Meet Xamarin.Forms Build native UIs for iOS, Android and Windows Phone from a single, shared C# codebase.
  11. 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. 12. Demo ■ File > New Project ■ Create a screen ■ Add some code ■ Run on iOS, Android, 
 & Windows Phone
  13. 13. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project
  14. 14. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project ■ NuGet Package
  15. 15. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project ■ NuGet Package ■ App Class
  16. 16. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project ■ NuGet Package ■ App Class ■ Android app
  17. 17. How Xamarin.Forms works Anatomy of a Xamarin.Forms Solution ■ PCL or Shared Project ■ NuGet Package ■ App Class ■ Android app ■ iOS app
  18. 18. 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
  19. 19. Platform Renderers Taking Xamarin.Forms UI to the people (devices) ? ? ?
  20. 20. Platform Renderers Taking Xamarin.Forms UI to the people
  21. 21. Platform Renderers Taking Xamarin.Forms UI to the people
  22. 22. Platform Renderers Taking Xamarin.Forms UI to the people
  23. 23. 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
  24. 24. 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
  25. 25. 140+ new Controls! http://components.xamarin.com From our Partners!
  26. 26. Demo ■ Write Platform Specific Code
  27. 27. Dependency Service Easily call into platform-specific code ■ In the common code ■ Code to an Interface public interface ITextToSpeech
 {
 void Speak (string text);
 }
  28. 28. 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");

  29. 29. 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);
 }
 }
  30. 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 ■ 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);
 }
 }
  31. 31. Data Binding Sync views and models ■ Enables MVVM-style development ■ SetBinding in C# ■ {Binding} in XAML ■ also supports the Command pattern
  32. 32. Custom Renderers Extend or Create Xamarin.Forms Controls ■ Subclass the built-in Platform Renderers ■ Build your own Xamarin.Forms
 control and renderers
 (eg. OxyPlot)
  33. 33. Further Reading… ■ developer.xamarin.com ■ forums.xamarin.com ■ Creating Mobile Apps with Xamarin.Forms - Charles Petzold
 Available as a FREE download
  34. 34. Thanks! Nish Anil @nishanil | nish@xamarin.com

×