Xamarin.Forms. Hands On



Similar documents
CROSS-PLATFORM MOBILE APPLICATION DEVELOPMENT WITH XAMARIN.FORMS

Microsoft Visual Studio: Developing Cross-Platform Apps With C# Using Xamarin

Einführung in die Windows Store App Entwicklung mit C# und XAML. Modul 2 Datenbindung und Zugriff auf das lokale Dateisystem

Essentials of Developing Windows Store Apps Using C# MOC 20484

Xamarin Cross-platform Application Development

Relationships in WPF Applications

Introduction to Building Windows Store Apps with Windows Azure Mobile Services

Developing Cross-Platform.NET Apps with ArcGIS Runtime

Microsoft Virtual Labs. Building Windows Presentation Foundation Applications - C# - Part 1

GOOGLE MOBILE ANALYTICS INTEGRATION. JANUARY 2013 (App version onwards)

Evaluation of Xamarin Forms for MultiPlatform Mobile Application Development

Creating a List UI with Android. Michele Schimd

Expanded contents. Section 1. Chapter 2. The essence off ASP.NET web programming. An introduction to ASP.NET web programming

HTML5 / NATIVE / HYBRID

INTRODUCTION TO IOS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 13 02/22/2011

Adding HTML5 to your Android applications. Martin Gunnarsson & Pär Sikö

Mobile App Design and Development

Take Your Team Mobile with Xamarin

Android Application Development

Q1. What method you should override to use Android menu system?

Sitecore Dashboard User Guide

Data Binding with WPF: Binding to XML

NemID JavaScript Client Integration for Mobile Applications

Hands-On Lab. Client Workflow. Lab version: Last updated: 2/23/2011

Database Communica/on in Visual Studio/C# using Web Services. Hans- Pe=er Halvorsen, M.Sc.

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

T300 Acumatica Customization Platform

Using Windows Azure Mobile Services to Cloud-Enable your Windows Store Apps in C#

Here to take you beyond Mobile Application development using Android Course details

Integrating InfoPath Forms. Paul Baker

Jordan Jozwiak November 13, 2011

آموزش DataGrid در WPF به همراه صفحه بندي و جستجوي انتخابی. کلیک کن

Tutorial: Windows Mobile Application Development. Sybase Unwired Platform 2.1 ESD #2

Enable Your Automated Web App Testing by WebDriver. Yugang Fan Intel

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio Lab version: Last updated: 12/10/2010.

Implementing multi-user multi-touch scenarios using WPF in Windows* 8 Desktop Apps

ASP.NET Dynamic Data

Filtered Views for Microsoft Dynamics CRM

Build apps your users will love with Xamarin. Mobile Edge 11 Nov 2015

Nintex Forms 2013 Help

Overview. About Interstitial Ads: About Banner Ads: About Offer-Wall Ads: ADAttract Account & ID

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

Android Application Development. Daniel Switkin Senior Software Engineer, Google Inc.

CSE476 Mobile Application Development. Yard. Doç. Dr. Tacha Serif Department of Computer Engineering Yeditepe University

ADITION Android Ad SDK Integration Guide for App Developers

STEVEN MANN. InfoPath* with. SharePoint HOW-TO. 800 East 96th Street, Indianapolis, Indiana USA

For details about using automatic user provisioning with Salesforce, see Configuring user provisioning for Salesforce.

DotNet Web Developer Training Program

Configuring an ios App Store application

Configuring Salesforce

Windows Presentation Foundation Tutorial 1

Take BI Beyond the Desktop! with Oracle BI Mobile App Designer

Arduino Training - Basics of Micro-controllers Programming Basics

Windows Store App Development

Android Basics. Xin Yang

SAMPLE CHAPTER. C# and XAML. Pete Brown MANNING

How to install and setup XLabs

Backend as a Service

Chapter 14 WCF Client WPF Implementation. Screen Layout

HybriDroid: Analysis Framework for Android Hybrid Applications

Unit and Functional Testing for the ios Platform. Christopher M. Judd

ComponentOne. Windows for WPF

Security API Cookbook

Sage CRM. Sage CRM 7.3 Mobile Guide

SharePoint Training DVD Videos

TS: Microsoft.NET Framework 3.5, ASP.NET Application Development

Xamarin Android Application Development

Admin. Mobile Software Development Framework: Android Activity, View/ViewGroup, External Resources. Recap: TinyOS. Recap: J2ME Framework

Skyline Interactive Tool Support

TTIWResponsiveList - TTIWDBResponsiveList

Getting Started Developing JavaScript Web Apps. this = that. VT Geospatial Forum 2015

Adobe Summit 2015 Lab 718: Managing Mobile Apps: A PhoneGap Enterprise Introduction for Marketers

Customize Mobile Apps with MicroStrategy SDK: Custom Security, Plugins, and Extensions

Reports and Documents Generator for SharePoint ver.: 2.2

A Way Out of the Mobile App Development Conundrum

About Blue Sky Sessions

Mumbai, India 1 kunalprajapati365@gmail.com 2 phadakedhananjay@gmail.com 3 archit.poddar@gmail.com

Creating a Website with Google Sites

Introduction to the BackgroundWorker Component in WPF

Address Phone & Fax Internet

Android Application Development - Exam Sample

Sage CRM. 7.2 Mobile Guide

My IC Customizer: Descriptors of Skins and Webapps for third party User Guide

Lecture 1 Introduction to Android

Database Forms and Reports Tutorial

Microsoft Dynamics AX Windows 8 App Starter Kit. App Development Guide Version 1.0

Transcription:

Xamarin.Forms Hands On

Hands- On: Xamarin Forms Ziele Kennenlernen von Xamarin.Forms, wich:gste Layouts und Views UI aus Code mit Data Binding Erweitern von Forms Elementen mit Na:ve Custom Renderer UI aus Xaml, Custom View mit XAML Aufrufen von Systemfunk:onen mit DependencyService

Pages hpp://developer.xamarin.com/guides/cross- plasorm/xamarin- forms/controls/pages/

Layouts hpp://developer.xamarin.com/guides/cross- plasorm/xamarin- forms/controls/layouts/

LayoutOp:ons Start Center End Expand WidthRequest HeightRequest

Views hpp://developer.xamarin.com/guides/cross- plasorm/xamarin- forms/controls/views/

UI Gallery Sample App Zeigt Verwendung wich:gster Elemente

App Lifecycle hpp://developer.xamarin.com/guides/cross- plasorm/xamarin- forms/working- with/app- lifecycle/

Demo App New Solu:on Blank Xamarin Forms App PCL Name, id etc. Project Structure Run on ios & Android

Demo App Step 1 New Solu:on Blank Xamarin Forms App PCL Name, id etc. Run on ios & Android

Demo App Step 2 Master Detail Page public class MasterDetail : MasterDetailPage Master: ListView Detail: ContentView Model: Shop ImageSource Image String Name String Descrip:on String URL

Data Binding / Cell Template var shops = new List<Shop>{ new Shop{Image= hpp://, Name= var list = new ListView { ItemsSource = shops, ItemTemplate = new DataTemplate (() => { var imagecell = new ImageCell (); imagecell.setbinding (ImageCell.ImageSourceProperty, "Image"); imagecell.setbinding (ImageCell.TextProperty, "Name"); imagecell.setbinding (ImageCell.DetailProperty, "Descrip:on"); return imagecell; ) ;

Select item / set detail binding context list.itemselected += (sender, e) => { Detail.BindingContext = e.selecteditem; IsPresented = false; ; list.selecteditem = shops [0];

Detail Page Data binding public class ShopPage : ContentPage{ this.setbinding (ContentPage.TitleProperty, "Name"); var shoplabel = new Label { XAlign = TextAlignment.Center ; Content = new StackLayout { Ver:calOp:ons = LayoutOp:ons.FillAndExpand, HorizontalOp:ons = LayoutOp:ons.FillAndExpand, Children = { shoplabel ; shoplabel.setbinding (Label.TextProperty, "Name");

Detail Page: Browser View var browser = new WebView{ Ver:calOp:ons = LayoutOp:ons.FillAndExpand, HorizontalOp:ons = LayoutOp:ons.FillAndExpand ; browser.setbinding (WebView.SourceProperty, "URL"); Navigate Back / Forward: Add BuPon (- > Horizontal StackLayout)

Problem: Reload missing GoForward GoBack Eval(string) Reload? (Na:ve Func:on)

Solu:on: Custom WebView, Renderer Create Class MyWebView : WebView public delegate void ReloadDelegate(); public ReloadDelegate Reload;

Android Renderer public class MyWebViewRenderer : WebViewRenderer { protected override void OnElementChanged (ElementChangedEventArgs< WebView> e) { base.onelementchanged (e); if (e.oldelement!= null) { ((MyWebView)e.OldElement).Reload - = DoReload; ((MyWebView)e.NewElement).Reload += DoReload; void DoReload(){ Control.Reload ();

ios Renderer public class MyWebViewRenderer : WebViewRenderer { protected override void OnElementChanged (VisualElementChangedEventArgs e) { base.onelementchanged (e); if (e.oldelement!= null) { ((MyWebView)e.OldElement).Reload - = DoReload; ((MyWebView)e.NewElement).Reload += DoReload; void DoReload(){ Reload ();

Magic using xyz; [assembly: ExportRenderer ( typeof (MyWebView), typeof (MyWebViewRenderer))] Namespace xyz{ public class MyWebViewRenderer

XAML View Create new Xaml View (ShopPage2) <?xml version="1.0" encoding="utf- 8"?> <ContentPage xmlns="hpp://xamarin.com/ schemas/2014/forms" xmlns:x="hpp://schemas.microsor.com/winfx/ 2009/xaml" x:class="shops.shoppage2 > <ContentPage.Content>. </ContentPage.Content> </ContentPage>

Xaml Content <StackLayout HorizontalOp:ons="FillAndExpand" Ver:calOp:ons="FillAndExpand"> <WebView x:name="browser Source="{Binding URL" HorizontalOp:ons="FillAndExpand" Ver:calOp:ons="FillAndExpand"/> <StackLayout Orienta:on="Horizontal"> <BuPon Text="Back" Clicked="BackClicked"/> <BuPon Text="Reload" Clicked="ReloadClicked"/> </StackLayout> </StackLayout>

CodeBehind Class public par:al class ShopPage2 : ContentPage { public ShopPage2 () { Ini:alizeComponent (); void BackClicked(object sender, EventArgs e){ browser.goback (); void ReloadClicked(object sender, EventArgs e){ browser.reload ();

Beispiel App Master- Detail auf ipad Quer

DependencyService Access Na:ve func:onality from shared code Declare Interface: public interface IToastService { void ShowToast(string text);

Implementa:on Android public class ToastService : IToastService { public ToastService () { public void ShowToast(string text){ var ctx = Forms.Context; Toast toast = Toast.MakeText(Forms.Context, text, ToastLength.Long); toast.show();

Implementa:on ios public async void ShowToast(string text){ var alert = new UIAlertView(text, null, null, null, null); alert.show (); await Task.Delay(3000); alert.dismisswithclickedbuponindex (- 1, true);

Magic Using xyz; [assembly: Xamarin.Forms.Dependency (typeof (ToastService))] Namespace xyz{ class.

Usage var service = DependencyService.Get<IToastService> (); service.showtoast("hallo Workshop"); APen:on: only one instance!

PlaSorm Tweaks hpp://developer.xamarin.com/guides/cross- plasorm/xamarin- forms/working- with/ plasorm- specifics/