A user interface built with Xamarin.Forms looks and feels native because it is native. Each of the available controls are rendered in the equivalent currently running platform view; for example, an Entry view is a UITextField
in iOS, an EditText
in Android, and a TextBox
in Windows Phone.
The great thing is that you can also create your own, or extend the existing ones. In this section, we will see how you can extend the view and customize the look and feel of the available Entry view.
Start by creating a cross-platform project in Xamarin Studio or Visual Studio. For this example, we used Visual Studio because we don't have to do extra work to create and connect the Windows Phone to Xamarin.Forms. Name the project
ViewCustomRenderer
.In the core PCL project, create a class file, Add | Class…, name it
CustomEntry
, and make it a subclass ofEntry
.We will need a main page, Add | New Item…, and choose to create a Forms Xaml...