I’m working on app that should be available for Phones and Tablets. But in tablets, we need to adjust the height of some items, because the image inside that elements are cropped
I’ve tried the solution proposed here, but it seems not working right on my case.
So i decided to try something different. I’ll try to bind the Height of the element to an Observable, and calculate that value based on the device Display Density. Since i can;t find a property on FuseJS/Environment that exposes the Display Density, my plan is to build a class that returns the value from the Display.Density value.
That is my code:
using Fuse;
using Fuse.Scripting;
using Uno.UX;
using Uno.Platform;
using Uno.Collections;
[UXGlobalModule]
public class Density: NativeModule
{
public static float get() {
return Display.Density;
}
}
But i get a error while compile
E3122: Uno.Platform.Display.Density is non-static and cannot be accessed from a static context
Before going further, i’m here to ask if there’s some undocumented property that exposes that property. If not i’ll try to find a solution (or adopt one if you are kind to suggest me one)
When you have a “tablet” in “portrait”, both Changes will get applied, and the result is unpredictable. Modifiers on the same target should be mutually exclusive. If you take a look at the responsive layout docs you linked and scroll down to where the example code is, you’ll see how the While*-triggers only describe mutually exclusive deviations from the rest state. That’s exactly what you should have.
But! That same example shows you another trick which you for some reason haven’t picked up. It’s about making Grid cells to be exactly square, disregarding the viewport size and orientation: