Can I increase the font size of a Xamarin.Forms Entry?

rafael.colonrafael.colon PRMember ✭✭

I am trying to increase the font size of a Xamarin.Forms Entry but I can't seem to find the property to do so in XAML.

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭

    should be something like FontSize

  • rafael.colonrafael.colon PRMember ✭✭

    @AlessandroCaliaro FontSize property is not availble for the Entry element

  • JohnHardmanJohnHardman GBUniversity mod

    @rafael.colon - @AlessandroCaliaro is correct. You simply use the FontSize property.

    The following is working code:

            Entry valueEntry = new Entry
            {
                BackgroundColor = Color.Silver,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Entry)),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Start,
                Placeholder = "Enter value",
                PlaceholderColor = Color.Gray,
                TextColor = Color.Black,
                VerticalOptions = LayoutOptions.CenterAndExpand
            };
    

    If you do not see a FontSize property on Entry, what version of Xamarin.Forms are you using? If it's an old version, can you update your NuGet packages?

  • ScottMobleyScottMobley USMember

    It appears you cannot use a style for setting the FontSize of an entry?
    Inline works

    It blows up with a:
    System.InvalidCastException: Specified cast is not valid.

    Forms 2.3.1.114

    Seems odd...

  • alaskanroguealaskanrogue USMember ✭✭✭

    On Windows Phone 8.1 using XF 2.3.1.114, I can't set the font using either XAML FontSize or by using FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Entry)). Anyone on this platform? Is this still a problem on the other platforms.

  • MarekMierzwaMarekMierzwa USUniversity ✭✭

    @ScottMobley said:
    It appears you cannot use a style for setting the FontSize of an entry?
    Inline works

    It blows up with a:
    System.InvalidCastException: Specified cast is not valid.

    Forms 2.3.1.114

    Seems odd...

    Same here... Very weird behavior...

Sign In or Register to comment.