How to set Width and Height to 'Entry' tag for platform specifics.

RakeshSainiRakeshSaini INMember ✭✭

we want to Change Width and Height of Entry tag in XAML file with platform specifics.
to Change width , i am going with below process-
<Entry>
Entry.Width> <OnPlatform x:TypeArguments="GridLength"> <On Platform="iOS">8*</On> <On Platform="Android">9*</On> </OnPlatform> </Entry.Width>
</Entry>

But i getting below error during project build -

Error Position 31:26. No property, bindable property, or event found for 'Width'

is it possible to set width and Height to Entry tag with platform specifics?

Best Answer

Answers

  • RakeshSainiRakeshSaini INMember ✭✭
    edited June 2017

    Thanks @VenkataSwamyBalaraju , But my app getting terminated !!
    if i removed this code then app working fine!!

  • RakeshSainiRakeshSaini INMember ✭✭
    edited June 2017

    i trying with below code -

                    `  <On Platform="iOS">8*</On>
                      <On Platform="Android,Windows">7*</On>`
    

    But app getting terminated!!

    if i try with
    <On Platform="iOS">80</On> <On Platform="Android,Windows">70</On>

    then its works fine !!

  • aliyasaraliyasar USMember ✭✭

    <Entry.HeightRequest> <OnPlatform Android="44" UWP="28" WPF="28" iOS="44" /> </Entry.HeightRequest>

  • MAJosephMAJoseph Member ✭✭

    Hi @VenkataSwamy I've some error like 'entry.heightrequest is not available'. How can I fix that?

  • VenkataSwamyVenkataSwamy INMember ✭✭✭
    edited January 8

    @AldoJoseph,
    It should be entry.HeightRequest not entry.heightrequest case sensitive issue

  • MAJosephMAJoseph Member ✭✭
    edited January 8

    @VenkataSwamy
    I did copy and paste your code. Here I've typed that without case sensitive.. Actually I did the correct method

  • VenkataSwamyVenkataSwamy INMember ✭✭✭
    edited January 8

    @AldoJoseph said:
    @VenkataSwamy
    I did copy and paste your code. Here I've typed that without case sensitive.. Actually I did the correct method

    Can you share piece of code

  • NMackayNMackay GBInsider, University mod

    @AldoJoseph said:
    @VenkataSwamy
    I did copy and paste your code. Here I've typed that without case sensitive.. Actually I did the correct method

    Try the new way of doing this (Assuming your using Forms 3.2.0 upwards)

    HeightRequest="{x:OnPlatform Android=38, iOS=36, UWP=30}"
    

    Much much cleaner

  • MAJosephMAJoseph Member ✭✭
    edited January 8

    @NMackay I think it is a version problem... Now I can't use the 'x:OnPlatform' . I'll check that

    Here the code

    Following namespaces I've used,
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

  • NMackayNMackay GBInsider, University mod

    @AldoJoseph said:
    @NMackay I think it is a version problem... Now I can't use the 'x:OnPlatform' . I'll check that

    Here the code

    Following namespaces I've used,
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

    Should be okay, same as my page

    <ContentPage
        xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    

    Delete the obj & bin folders of the .NETStandard/PCL library and rebuild it and see if it still complains

  • MAJosephMAJoseph Member ✭✭
    edited January 9

    @NMackay Ok I'll try. Thanks

Sign In or Register to comment.