设置高度项渲染xamarin表单ios

设置高度项渲染xamarin表单ios,ios,xamarin,xamarin.ios,xamarin.forms,controls,Ios,Xamarin,Xamarin.ios,Xamarin.forms,Controls,我需要修改和自定义Xamarin中的入口控件,但是我很难设置,或者更确切地说,我很难找到声明Xamarin ios控件高度的方法。 我该怎么办?这是我的密码 [assembly: ExportRenderer(typeof(MyEntry), typeof(MyEntryRenderer))] namespace MyApplication.iOS { public class MyEntryRenderer : EntryRenderer { //CUSTOM

我需要修改和自定义Xamarin中的入口控件,但是我很难设置,或者更确切地说,我很难找到声明Xamarin ios控件高度的方法。 我该怎么办?这是我的密码

[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 ???
            }
        }
    }
}
[程序集:导出呈现程序(typeof(MyEntry)、typeof(MyEntryRenderer))]
名称空间MyApplication.iOS
{
公共类MyEntryRenderer:EntryRenderer
{
//自定义条目渲染IOS
受保护的覆盖无效OnElementChanged(ElementChangedEventArgs e)
{
基础。一个要素发生变化(e);
if(控件!=null)
{
Control.BackgroundColor=UIColor.FromRGB(43,50,58);
Control.TextColor=UIColor.FromRGB(255、255、255);
//控制,高度???
}
}
}
}

跨平台入口类上有一个HeightRequest属性。为什么不将它设置在那里,让Xamarin的渲染器完成工作

如果要直接在自己的渲染器中设置,请尝试

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

您可以在PCL/共享端进行设置

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

需要详细说明吗?MyEntry从ios render获取属性,这些属性没有HeightRequest属性