I want to set position attribute of an UIElement to an absolute value of X and Y. How can I do this operation? And why absolute positioning in UWP is so hard?
How to set absolute position for an UIElement in UWP?
First of all, absolute position in UWP is so hard, because GUI child elements built relative to the parent element(Page, Grid and etc) You can see, that if you open documentation to UIElement and open Property ActualOffset, you can see, that:
Gets the position of this UIElement, relative to its parent, computed during the > arrange pass of the layout process.
But you can change the point relative to which the coordinates are calculated by class GeneralTransform. Example you can see in this ticket.
Maybe this will be helpfull Canvas.SetLeft && Canvas.SetTop
Note, this risks being perceived as a link-only answer and being flagged as not an answer. I think the mentioning of the features alone is more than link-only. But you might want to write a little more directly here. –
Chance
© 2022 - 2024 — McMap. All rights reserved.
Canvas.Left
andCanvas.Top
to the desired x and y values. – LithomargeMargin
property of your element – Compressed