How to start with Xamarin from basic steps
Here are few steps prepared by my colleague so hope it will help you to start with Xamarin basic app.
Xamarin Setup Requirements
- Visual Studio 2015 with full features.
- Java SDK 1.7 Kit.
- Window Operation system 7, 8
- Xamarin Installer
- Xamarin Android Player Emulator.
Xamarin Introduction
Build native UIs for iOS, Android and Windows, from a single, shared C# codebase.
URL
Xamarin Forms
URL
Introduction
Take code sharing to the next level with Xamarin.Forms. Intro to iOS and Android teach you how to share core logic across platforms, and Xamarin.Forms lets you define a singular UI that creates a native user experience for iOS, Android, and Windows.
Xamarin Pages Types
Page is an Abstract class used to define a single of content.
- Content
- Master detail
- Navigation
- Tabbed
- Carousel
Views
View is the base class for all visual control, Most Standard controls are listed below:
- Label
- Image
- searchBar
- Entry
- Progress Bar
- Activity Indicator
- Button
- Slider
- Open Gridview
- Editor
- Stepper
- Webview
- Datepicker
- Switch
- Listview
- Box view
- Frame
- Picker
Configuration Manager Option
Any CPU >> Configuration environment
You can set Active Solution platform for three solutions.
1. Window simulator= X86
2. Android = ARM
3. IOS = IPhone Simulator
How to create Xamarin Form Project Solutions
File >> new project >> Mobile APPS >> Blank App (Xamarin Form Portable)
Click on blank app application will be created with four solutions.
Add Xamarin Android player into VS 2015
Tools >> Android >> Android Adb command prompt >> write Adb >> Adb connect IP address
4 Solutions Added Successfully:
- Portable Solution, Platform specific projects, Platform Specific, Android, Xamarin forms.
- Android
- IOS
- Window Phone
Xamarin Form Layout Container
Layout Containers organize child elements based on specifics rules.
.XAML Layout
1. Stack Layout - This layout is used for typical form style layout
- Vertical option
- Horizontal option
- Spacing
- padding
2. Absolute layout
3. Relative layout
4. Grid Layout
Xamarin Form Architecture
Xamarin forms has two projects that work together to provide the logic + UI for each executable
1. Portable class
- Shared Across all platform
- Limited access to .net APIs
- Want most of our code
2. Platform Specific Project
- 1 per platform
- Code is not shared
- Full access to .Net apis
Changing the UI per platform
- Device On platform allows you to fine tune the UI for each platform.
Can execute specific logic per platform using delegates for each platform.
Detecting platform
Can use the static Device class to identify the platform and device style
- Xamarin.forms.maps
- Device.BeginInvoke.onmainthread
Use XAML in Xamarin
Views and Layout in Xamarin.Forms
Pages
Xamarin.Forms pages represent cross-platform mobile application screens. For more information about Pages, See
1. Content Page
2. MasterDetail page
3. Navigation Page
4. Tabbed Page
5. Templated Page
6. Carousel page
Layouts
Xamarin.Forms layouts are containers used to compose views into logical structures. For more information about Layouts, see
1. Content Presenter
2. Content View
3. Scroll view
4. Frame
5. Templated view
6. Stack layout
7. Gridlayout
8. Relative Layout
Views
Xamarin.Forms views are the controls displayed on the user interface, such as labels, buttons, and text entry boxes. For more information about Views, see
ActivityIndicator
|
BoxView
|
Button
|
DatePicker
|
Editor
|
Entry
|
Image
|
Label
|
Listview
|
Map
|
OpenGlView
|
Picker
|
ProgressBar
|
SearchBar
|
Slider
|
TableView
|
TimePicker
|
Webview
|
EntryCell
|
ImageCell
|
Switch Cell
|
TextCell
|
ViewCell
|
Cells
Xamarin.Forms cells are specialized elements used for items in a list, and describe how each item in a list should be drawn. For more information about Cells, see Xamarin.Forms Cells
Listview in Xamarin Form
The Listview control is responsible for displaying a collection of items on the screen – each item in the Listview will be contained in a single cell.
Data Binding
Data binding connects two objects, called the source and the target. The source object provides the data. The target object will consume (and often display) data from the source object. For example, a Label (target object) will commonly bind its Text property to a public string property in a source object
Object (Source Property) <----------> Binding <--------> Property (UI Control Target)
XAML
The following code shows an example of performing data binding in XAML:
<Entry Text="{Binding FirstName}" ... />
Navigation
Xamarin.Forms provides a number of different page navigation experiences, depending upon the Page type being used. For ContentPage instances there are two navigation experiences:
There are two types of Navigation:-
Hierarchical Navigation
The Navigation Page class provides a hierarchical navigation experience where the user is able to navigate through pages, forwards and backwards, as desired. The class implements navigation as a last-in, first-out (LIFO) stack of Page objects.
Public App ()
{
MainPage = new NavigationPage (new EmployeeListPage ());
}
Button button2 = new Button
|
{
|
Text = " Go to Image Demo Page ",
|
Font = Font.SystemFontOfSize(NamedSize.Large),
|
BorderWidth = 1
|
};
|
await Navigation.PushAsync(new LoginPage());
button2.Clicked += async (sender, args) =>
|
await Navigation.PushAsync(new ImageDemoPage());
|
Modal Navigation
Xamarin.Forms provides support for modal pages. A modal page encourages users to complete a self-contained task that cannot be navigated away from until the task is completed or cancelled.
Syntax
await Navigation.PushModalAsync(new LoginPage());
await Navigation.PopModalAsync();
Syntax is my UI
Create UI Login Page for Android, IOS and windows phone with Xamarin.Forms
Xamarin Controls
ActivityIndicator BoxView Button DatePicker Editor
Entry Image Label Listview Map
OpenGlView Picker ProgressBar SearchBar Slider
TableView TimePicker Webview EntryCell ImageCell
Switch Cell TextCell ViewCell
Xamarin University Video Xamarin.Forms
Xamarin Android Player Download Link
XAML Form Page in Xamarin.Forms
· https://developer.xamarin.com/guides/xamarin-forms/getting-started/introduction-to-xamarin-forms/
Create Login Screen Using XAML
Xamarin.Forms Architecture Diagram
IOS--------------> Android -------------> Windows Phone
-------------------------------Core Layer -------------------->>>>>>>>>>>>>>>>>>>>
Business Layer
Service Access layer Data access layer Data layer
Build native UIs
Each OS-specific application provides a different user-interface layer (implemented in C# with the assistance of native UI design tools):
- On iOS, use the MonoTouch.UIKit APIs to create native-looking applications, optionally utilizing Xamarin's iOS designer to create your UI visually.
- On Android, use Android.Views to create native-looking applications, taking advantage of Xamarin’s UI designer
- On Windows Phone you will be using the XAML/Silverlight presentation layer, using Visual Studio or Blend’s UI designer
- On Windows 8, use the Metro APIs to create a native user experience.
Xamarin Call Dial Demo
Installing Xamarin IOS on Window
· https://developer.xamarin.com/guides/ios/getting_started/installation/windows/#Configuring_The_Mac
Creating Xamarin form app in visual studio
First connect with mac using remote login. Tools IOS mac agent.
After successfully connected with mac agent. We will creating app in Xamarin.Forms.
File ----------> New project-----------> Cross platform-----------> Blank app (Xamarin.Forms portable)
App name-----------> WinSetupdemo
XAML Demo Project
XAML Practice Links
Alert Display
Redirect One Page to Another using navigation Page class
List view Control bind with List
Phone Number Dial App
· https://developer.xamarin.com/guides/xamarin-forms/getting-started/hello-xamarin-forms/quickstart/
Data Pages
Themes
Get Started with XAML in Xamarin Forms
Animation in Xamarin-forms
Android Splash Screen creation process
IOS project Setup
Comments
Post a Comment