Screen size

Hi all !

First, is there any way to define the size of an element relatively to the entire screen and not to its parent ?

For example, I have an element and I want it to be 50% of the screen size when clicked, no matter the size of his container

And also, do we have access to the size of the screen in “standardized dots" and/or in pixels ?

Thanks !

There is no direct way to get the size of the screen in UX. From Uno code you can get the Viewport size, but that isn’t necessarily the size of the screen.

There is also LayoutMaster. This binds the placement of an element to that of another one. It has some limitations, but it should work for this situation.

Before I give an example perhaps you can better explain your use-case, or give a sample UX that comes close, but not quite to what you want. This way I can better determine what the best solution would be.

LayoutMaster does exactly what I wanted. I just change this LayoutMaster to “myPage”, then I can choose the size relatively to the whole page. I have a problem about resizing from Points to %, but I made another thread (here : https://www.fusetools.com/community/forums/howto_discussions/resize_from_points_to_percents).

EDIT : It seems like I can’t change the LayoutMaster property dynamically :

<App Theme="Basic" Background="#eeeeeeff">
    <DockPanel ux:Name="page">
        <Panel Width="50%" Height="50%" >
            <Rectangle ux:Name="rect" Fill="#ccc" CornerRadius="15" ClipToBounds="true">
                <Clicked>
                    <Set rect.LayoutMaster="page"/>
                </Clicked>
                <Image File="Assets/background1.png" StretchMode="Scale9" />
            </Rectangle>
        </Panel>
    </DockPanel>
</App>

This doesn’t work. Is it possible to set it ? To animate it ? What I would like is : when clicked, the image slowly grows to cover all the screen. Thanks !