introduction to xamarin.forms and lessons learnt

49
www.michaelridland.com @rid00z Introduction to Xamarin.Forms

Upload: michael-ridland

Post on 29-Jun-2015

887 views

Category:

Technology


3 download

DESCRIPTION

Presentation given a Sydney Mobile .NET usersgroup. First part is an introduction to Xamarin.Forms and the second half with some tips and tricks. If you have any questions or need any help with Xamarin.Forms, find me over at http://www.michaelridland.com I'm always happy to help.

TRANSCRIPT

  • 1. Introduction toXamarin.Formswww.michaelridland.com @rid00z

2. Portable Class Libraries 3. Xamarin + Xamarin.FormsWith Xamarin.Forms:more code-sharing, native controlsTraditional Xamarin approachShared UI Codewww.michaelridland.com @rid00z 4. Whats Included 40+ Pages, Layouts, and Controls Build from code behind or XAML Two-way Data Binding Navigation Animation API Dependency Service Messaging CenterShared UI Codewww.michaelridland.com @rid00z 5. PagesContent MasterDetail Navigation Tabbed Carouselwww.michaelridland.com @rid00z 6. LayoutsStack Absolute Relative Grid ContentView ScrollView Framewww.michaelridland.com @rid00z 7. ControlsActivityIndicator BoxView Button DatePicker EditorEntry Image Label ListView MapOpenGLView Picker ProgressBar SearchBar SliderStepper TableView TimePicker WebView EntryCellImageCell SwitchCell TextCell ViewCellwww.michaelridland.com @rid00z 8. DEMO 1Displaying List of Datawww.michaelridland.com @rid00z 9. Model-View-ViewModelDataDataView ViewModel ModelHow to displayinformationWhat to displayFlow of interactionBusiness LogicData objectsEventswww.michaelridland.com @rid00z 10. Model-View-ViewModelDataView ViewModel ModelEventsXamarin.FormsData Bindingwww.michaelridland.com @rid00z 11. Data Bindingwww.michaelridland.com @rid00z 12. Data Bindingwww.michaelridland.com @rid00z 13. Data Bindingwww.michaelridland.com @rid00z 14. Data Bindingwww.michaelridland.com @rid00z 15. DEMO 2Stocks Appwww.michaelridland.com @rid00z 16. www.michaelridland.com @rid00z 17. ExtensibilityCustom RendererEasily subclass any control you wish tocustomize.Add your own custom controls.Add custom bindable propertieshttp://developer.xamarin.com/guides/cross-platform/xamarin-forms/custom-renderer/www.michaelridland.com @rid00z 18. ExtensibilityStandard Entry Controlwww.michaelridland.com @rid00z 19. ExtensibilityStep 1: Custom Xamarin.Forms Controlwww.michaelridland.com @rid00z 20. ExtensibilityStep 2: Use Custom Control in our shared Pageswww.michaelridland.com @rid00z 21. ExtensibilityStep 3: Implement Custom Rendererwww.michaelridland.com @rid00z 22. ExtensibilityStep 4: Export Rendererwww.michaelridland.com @rid00z 23. ExtensibilityDependency ServiceLets shared code access platform-specific SDK features via an Interfaceimplementationwww.michaelridland.com @rid00z 24. ExtensibilityStep 1: Interfacewww.michaelridland.com @rid00z 25. ExtensibilityStep 2: Implement on each Platformwww.michaelridland.com @rid00z 26. ExtensibilityStep 3: Register with Dependency Servicewww.michaelridland.com @rid00z 27. ExtensibilityStep 4: Access from shared codewww.michaelridland.com @rid00z 28. DEMO 3Stocks App +Text to Speechwww.michaelridland.com @rid00z 29. Animations APIwww.michaelridland.com @rid00z 30. www.michaelridland.com @rid00z 31. NavigationRoot Page:NavigationPage Gives each page an INavigationStandard NavigationNavigation.PushAsync(page: nextPage);Navigation.PopAsync();Modal NavigationNavigation.PushModalAsync(page: modalPage);Navigation.PopModalAsync();www.michaelridland.com @rid00z 32. Messaging CenterMessagingCenter.Subscribe(object subscriber, string message, Action callback);MessagingCenter.Send(T item, string message);www.michaelridland.com @rid00z 33. Messaging CenterMaster Page:Detail Page:www.michaelridland.com @rid00z 34. Xamarin.FormsMy Experiences and Tipswww.michaelridland.com @rid00z 35. Good PartsFast and Easy to Create Cross Platform UIElementsSome good features/extensibility points - customrenderers, message centre etc.The idea and concept is great. But we all need topitch in to make it better, aka Xamarin.Forms.Labs.www.michaelridland.com @rid00z 36. Not so good partsAt the moment it still stuffers from common denominator. e.g.Save and Cancel are different on Android, iOS and WP.The coverage of UI elements isnt hugeTiny Cuts - No Bordering, ToolBarButtons only on rightside,Only TapGestureRegonizers, Picker not databoundwww.michaelridland.com @rid00z 37. Tip 1. Dont fight the frameworkI want Cancel here because thats how I do it in iOSI want swipe cell because thats how I do it in iOSIf you use Xamarin.Forms, try not to bring in pre conceptions of how youwant your UI to be. You can build nice UIs with Xamarin.Forms but you justneed to be within its constraints and no swipe cells.www.michaelridland.com @rid00z 38. Tip 2. PrototypePrototype your app in Xamarin.Forms.. see if its going to workTraditional Xamarin.iOS and Xamarin.Android is still great if you want aamazing experience on all platforms.www.michaelridland.com @rid00z 39. Tip 3. Xamarin.Forms.Device.StartTimerwww.michaelridland.com @rid00z 40. Tip 4. StackLayout, BoxView to style formswww.michaelridland.com @rid00z 41. Tip 5.Preview PETZOLDs Xamarin.FormsBookhttp://blogs.msdn.com/b/microsoft_press/archive/2014/10/06/www.michaelridland.com @rid00z 42. Tip 6. Xamarin.Forms.LabsFill some gaps in Xamarin.FormsLabs Demo!(*Labs is really labs code, recommended to work off the code)www.michaelridland.com @rid00z 43. Tip 6. Xamarin.Forms.LabsWhat else is there?- HybridWebView can be useful when used Razor!- INetwork service get the InternetConnectionStatus (WIIFI)?- Photo library/take a photo- Extended TextFields - Fonts and Border properties- + Morewww.michaelridland.com @rid00z 44. Tip 7. Giving back to Xamarin.Forms.LabsWe need you!- Fork Xamarin.Forms.Labs in GitHub- Clone to your local machine- Build the Xamarin.Forms.Labs Project- Add the projects into your project- add new features- Do a pull Request back into the Projectwww.michaelridland.com @rid00z 45. Tip 8. Bindable Property code templatepublic static readonly BindableProperty $Name$Property= BindableProperty.Create(p => p.$Name$, default($type$));public $type$ $Name$ {get { return ($type$)GetValue($Name$Property); }set { SetValue($Name$Property, value); }}www.michaelridland.com @rid00z 46. Tip 9. Xamarin Hack Day SydneyXamarin Hack Day Sat 6th Decwww.xamarinhackday.comPlease come along for a great day!* Want to present? Twitter me @rid00zwww.michaelridland.com @rid00z 47. Tip 10. Layer Views using AbsoluteLayoutwww.michaelridland.com @rid00z 48. ResourcesDocumentationhttp://developer.xamarin.com/guides/cross-platform/xamarin-forms/XAML Documentationhttp://developer.xamarin.com/guides/cross-platform/xamarin-forms/xaml-for-xamarin-forms/Sampleshttps://github.com/xamarin/xamarin-forms-sampleswww.michaelridland.com @rid00z 49. Q & AFind Me:[email protected] @rid00z