Why are those OnPlatform lines deprecated?

axbeitaxbeit Member ✭✭

Hey there.

<OnPlatform x:TypeArguments="Thickness"
iOS="10"
Android="10"/>

is deprecated. As far as I know this should be used:

        <OnPlatform x:TypeArguments="Thickness">
            <On Platform="iOS">10</On>
            <On Platform="Android">10</On>
        </OnPlatform>

Same here. This is obsolete:

Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);

instead a switch case similar to this should be used:

            int tVal;
            switch(Device.RuntimePlatform)
            {
                case Device.iOS:
                    tVal = 10;
                    break;

                default:
                    tVal = 10;
                    break;

            }
            Padding = new Thickness(0, tVal, 0, 0);

And I don´t understand why. The deprecated/obsolete way is shorter. Is this performance related or something else??

Best Answer

Answers

  • mischelmischel DEMember ✭✭

    Hey, how make I this with OnIdiom?

Sign In or Register to comment.