All right, guys.
So let's take a look at platform specific markup.
So what happens is that remember that we have one code base, one set of pages and controls, and we
have to serve multiple devices.
So some devices may have certain design considerations that others.
And Malawi makes it very easy for us to specify certain values for certain operating systems within
the code, so it will contextually load or render the content according to what is declared.
So let us start off with looking at how we would see on which device we want, whatever margin or padding
with our vertical stack little.
So for context, I'm back in the layout, that XAML file.
And in this file, what I'm going to do is give it a neat right.
So I'm going to see x colon m is equal to and then that's a C layout.
V stuck.
Ah, that's a movie stuck out.
Let me do the stack layout.
All right, so now that we have that name in the code, we and I can make reference.
It's right in the layout constructor.
What if I wanted to see that the v stuck layout dot harding?
I want this to be equal to something different.
If it's an iOS platform versus if it's anything else.
Right.
So I can see device info, which is a special class given to us that allows us to specify the platform.
So device info dot platform if it is equivalent.
And then we have access to the device platform, which is pretty much an enum as soon as I see there
trigger.
So device platform we can specify for Android, iOS, Mac, Catalyst, Mac OS, Diesel, etc., etc..
You see all the devices here.
They can actually try to facilitate it.
So let's us say that for iOS, if the device platform is for the iOS, then I'm just going to use that
ternary operator here.
Then we want to define new thickness, which is the object or the struct used for padding.
So I mean, backtrack a bit.
So if it is iOS, then we want new thickness.
And let's say I want to add 30 by ten, by 30 by ten, etc., and then otherwise I would want it to
be just 30 all around.
So I can just say, ah, let's just say 25.
All right.
And that's it right there.
I just specify that I wanted the padding to be different.
If we're using an iOS device, that is what I want.
Otherwise, for any other device to do that.
So obviously, if you wanted to cater to more scenarios, you'd probably want to use an if statement
or a switch statement so that it's not a ternary operator where we're only comparing with one at a time.
Right.
So that is all.
We'll do it in the in the code behind.
Now, alternatively, in the markup, what we could do is put the attributes of padding is equal to
and then we could superimpose our on platform right here.
So it could say on platform and then we just list out all of the potential platforms.
And here we can start off with iOS once again and we can define the values that we just used.
Let me just see if I can go ahead and grab them quickly.
So we use some arbitrary, but I'm not really taking that seriously right now.
But we can define them.
They would have to be in single quotes, single quotes, because they're already inside of double quotes
here.
So don't use single quotes to specify the iOS values and any other value.
And then like we did, we did iOS and then default.
So comma.
And then you'll see default as one of the options, which means that anything that's not iOS.
What valid do you want?
I want it to be, let's say 30.
Right.
So that is a nice way to just specify that the padding on platform iOS that that we could also do something
with that a background color, right.
So I could see background color here.
Right.
And then do the same thing on platform.
On platform.
I was I wanted to be, let's say, green.
Right.
On Android, I want it to be Alice Blue, etc. so we could go on and on and on.
So that is all we can do.
Platform specific configurations in the same markup, once again, utilizing our singular code base
to the max.