Professional Documents
Culture Documents
- VM-Ware: AirWatch
- MicroSoft: InTune
Apple: TestFlight
Xamarin: HockeyApp
===================
Pages, Layouts, Views, Cells
++++++++++++++++++++
Pages: VisualElements, IPageCntrol
- ContentPage,
- MasterDetailPage
- TabbedPage
- NavigationPage,
- CarouselPage
++++++++++++++++++++
Layouts: Layout<View>
- StackLayouts,
- AbsoluteLayout,
- RelativeLayouts,
- Grid,
- ContentView,
- ScrollView,
- Frame
++++++++++++++++++++
View: VisualElements
- Image,
- Label,
- ListView,
- OpenGLView,
- Picker,
- ProgressBar,
- SearchBar,
- Slider,
- Stepper,
- TableView,
- TimePicker,
- WebView
++++++++++++++++++++
Cells
- EntryCell
- SwitchCell
- TextCell
- ImageCell
===================
Custom Renderer
++++++++++++++++++++
using Android.Graphics;
using Customization.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
namespace Customization.Droid
{
public class StyledLabelRenderer : LabelRenderer {
protected override void OnElementChanged(
ElementChangedEventArgs <Label> e ) {
base.OnElementChanged( e );
var styledLabel = (StyledLabel)Element;
switch (styledLabel.Style) {
case StyleType.Bold:
Control.SetTypeface(null, TypefaceStyle.Bold);
break;
case StyleType.Italic:
Control.SetTypeface(null, TypefaceStyle.Italic);
break;
case StyleType.BoldItalic:
Control.SetTypeface(null, TypefaceStyle.BoldItalic);
break;
}
}
}
}
++++++++++++++++++++
PCL: Accessing Native Features
++++++++++++++++++++
Use Dependency Service - i.e. dependency injection (DI) or inversion
of control (IoC)
1. Define an interface:
1.1 Retrieval :
var service = DependencyService.Get<ISomeService>( );
service.PerformActivity();
Android :
public class Service_Android : ISomeService {
public void PerformActivity( ) {
// Native Android
implementation
}
}
Retrieval :
var service = DependencyService.Get<ISomeService>( );
service.PerformActivity();
++++++++++++++++++++
XAML Data Binding using markup extension
++++++++++++++++++++
1. Define Data Binding using XAML markup extension:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="…" x:Class="…">
<StackLayout>
<Button Text="Click Me" Clicked="Button_Clicked" />
<Label Text="{Binding LabelText}" />
<Entry Text="{Binding EntryText}" />
</StackLayout>
</ContentPage>
2. Drive from INotifyPropertyChanged interface:
public interface INotifyPropertyChanged
{
event PropertyChangedEventHandler PropertyChanged;
}
to implement PropertyChangedEventHandler event and handler: