On Device Type
Last updated
Last updated
This is deprecated in Rock Mobile V6 and later. for .NET MAUI.
Similar to the , this extension lets you change property values and entire nodes depending on what type of device the app is running on. A good use case for this would be if you want to display a different image on tablets than you do on phones.
Property
Type
Description
Phone
object
The value to be used when the device is a phone.
Tablet
object
The value to be used when the device is a tablet.
Default
object
The value to be used when the device is something else.
When running on a phone, the image will have a height of 300 pixels. But on a tablet it will only have a height of 150 pixels. This might be useful if you are worried that the image might take up too much vertical space on a tablet under normal sizing circumstances.
Here is a more interesting example. In this case we are replacing not just a property but an entire element. On tablet devices, they will see a button which they can tap. On every other device type they will see a label that informs them the feature only works on tablets.