How to increase height of iOS Picker (Entry field)

BuddWrightBuddWright USMember
edited September 2016 in Xamarin.Forms

In the iOS version of the Xamarin.forms app I'm writing, I need to increase the height of the Entry field that you touch in order to show the picker (not the wheel picker view itself that appears when you click/touch the entry field). My XAML is a simple , and for Android and WinPhone, I was able to create custom effects attached to it that did this one way or another.

However, the iOS Control (UIKit.UITextField) doesn't seem to have a simple way of updating or modifying the height of the underlying touchable Entry field. Looking at something like this: https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.iOS/Renderers/PickerRenderer.cs

It seems there's definitely an underlying Entry / text field that gets created natively, with just focus enabled... but how can we modify the height of it??? Or, barring that, to get creative... how can we modify the padding inside of it to artificially increase the height??

Why is this so difficult, surely I can't be the only one that has ever needed to adjust the height of the picker control??

Tagged:

Best Answer

Answers

  • BuddWrightBuddWright USMember

    Anyone?

  • kishangkishang PHMember ✭✭

    If you want it for all of your custom picker, you can do it in the constructor of your picker:

    using System;
    using Xamarin.Forms;
    
    namespace myApp
    {
    public class CustomPicker :Picker
    {
        public CustomPicker()
        {
            HeightRequest = 200;
        }
    }
    }
    
  • BuddWrightBuddWright USMember

    @kishang -- wait, so does a Picker have the HeightRequest attribute? I didn't realize that, it's not in the documentation, nor does it seem to appear with Intellisense, although sometimes that seems to happen when working with xaml.

    I'll give HeightRequest a try, and if that works, kick myself for overthinking it. ;)

  • BuddWrightBuddWright USMember

    I swear I had tried HeightRequest to no effect before, but that does indeed work on Picker, which is just a regular view control, and therefore makes sense... thanks!

Sign In or Register to comment.