How to get Window width/height
-
wrote on 28 Jun 2015, 15:53 last edited by
I'm trying to get Window width by calling:
- Window.width
However it returns "undefined". It's the same for other Window properties:
- Window.height
- Window.x
- Window.maximumWidth
I tried to use it instead of calling some root Item:
- itemId.width
because in some Screen.onHeightChanged callback it returns 0.
Why is it undefined ? Do I make something wrong ?
-
I'm trying to get Window width by calling:
- Window.width
However it returns "undefined". It's the same for other Window properties:
- Window.height
- Window.x
- Window.maximumWidth
I tried to use it instead of calling some root Item:
- itemId.width
because in some Screen.onHeightChanged callback it returns 0.
Why is it undefined ? Do I make something wrong ?
Hi @lajtu,
Since those are not attached properties they will need to be accessed byid
i.eWindow
'sid
. -
wrote on 29 Jun 2015, 07:42 last edited by
Aww, OK. I thought it works the same as Screen, e.g.
- Screen.width
-
@lajtu For
Screen
it works becausewidth
is an Attached Property for it.
2/4