简体   繁体   中英

Custom Control in Xamarin.Forms from scratch

I would like to write a custom control which will look like this one using Xamarin.Forms. I know that when we want to modify the existing control from Xamarin.Forms we are using Custom Renderers , but this control is something more than Entry and the solution is not obvious to me.

My question is how do I start working on this task? What control should I extend if I would like to use custom renderer? Is there some other more effective way to achieve this?

Looks like the linked control is extending a UIPickerView .

You have two options

  1. Create the binding for https://github.com/nicklockwood/CountryPicker
  2. Create your own Xamarin.Forms control, which is basically a custom renderer. You can refer the Forms source code to create the controls for it.

You should create a pure Xamarin.Forms view class and renderers (inherited from ViewRenderer ) for each platform.

Please have a look at XLabs projects - it should be a good point to start:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM