0
votes

I have need to modify and customize the Entry Control in Xamarin, but I have difficulty setting, or rather to find the method for declaring the height of the control of Xamarin ios. How can I do ? here is my code.

[assembly: ExportRenderer(typeof(MyEntry), typeof(MyEntryRenderer))]
namespace MyApplication.iOS
{
    public class MyEntryRenderer : EntryRenderer
    {
        //CUSTOM entry RENDER IOS
        protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.BackgroundColor = UIColor.FromRGB(43, 50, 58);
                Control.TextColor = UIColor.FromRGB(255, 255, 255);  
                //Control.Height ???
            }
        }
    }
}
2

2 Answers

0
votes

There's a HeightRequest property on the cross-platform Entry class. Why not set it there and let Xamarin's renderer do the work?

If you want to set it directly in your own renderer try

Control.Frame = new CGRect(0, 0, width, height);
-1
votes

You can set this on PCL/shared side.

public MyEntry()
{
    this.HeightRequest = 50;
}