Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Override Entry properties in iOS

$
0
0

I able to change the property of existing entry using below function in android, by doing this i was able to change the font size and font family of all entry used without creating a subClass like MyEntry , CustomEntry etc etc:

****[assembly: ExportRenderer(typeof(Entry), typeof(xx.Droid.Controls.EntryRenderer))]
namespace xx.Droid.Controls
{
public class EntryRenderer : Xamarin.Forms.Platform.Android.EntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);

        if (e.OldElement != null || e.NewElement != null)
        {

            Control.TextSize = 12f;
            Control.Typeface = Typeface.CreateFromAsset(Context.Assets, "OpenSans-Regular.ttf");
        }

    }
}

}****

But when i try to do the same for iOS. it is not working:

**[assembly: ExportRenderer(typeof(Entry), typeof(xx..iOS.Controls.EntryRenderer))]
namespace Mobilefacilities.iOS.Controls
{
public class EntryRenderer : ViewRenderer<Entry, UITextField>
{
public EntryRenderer()
{

    }
    protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
    {
        base.OnElementChanged(e);

        if (e.OldElement != null || e.NewElement != null)
        {

            Control.Font = UIFont.FromName("OpenSans-Regular", 12f);
            Control.TextColor = UIColor.FromRGB(127,127,127);



        }

    }
}

}**

Please help if it is even possible in iOS, if yes what is that i am not doing correct?. Thanks in advance!!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>