![Picture](/uploads/3/0/8/5/30851839/7949966.png?1403134466)
Yeah, you heard me, User Interface Code share. In the previous version, developer have no way to write the same UI code that will run on iOS, Android and WinPhone. What Xamarin.Form provide is, the abstract of the UI control, where implementation of the actual UI control will be running by the platform specific native control in separate project.
Xamarin.Form embrace MVVM framework and it was designed to work exactly how C# developer expect to work. It also provide a way write your own customize UI control called Render-er.
For this release there are about 40 controls. I am looking forward to see more in the next release.
As you can see below developer only need to specify what are the UI elements that need to be display on the phone, then Xamarin.Form will generate those elements into platform specific native UI.
For example, Tab header in iOS is at he bottom, where Android and WinPhone is at the top
var profilePage = new ContentPage {
Title = "Profile",
Icon = "Profile.png",
Content = new StackLayout {
Spacing = 20,
Padding = 50,
VerticalOptions = LayoutOptions.Center,
Children = {
new Entry { Placeholder = "Username" },
new Entry { Placeholder = "Password", IsPassword = true },
new Button { Text = "Login", TextColor = Color.White, BackgroundColor = Color.FromHex("77D065") }
}
}
};
var settingsPage = new ContentPage {
Title = "Settings",
Icon = "Settings.png",
(...)
};
var mainPage = new TabbedPage { Children = { profilePage, settingsPage } };