docs-maui
docs-maui copied to clipboard
The documentation for AbsoluteLayout seems to have incorrect information
Issue description
Unless I am misunderstanding something, the documentation in the Position and Size children /absolutelayout.md appears to give incorrect information in the(https://github.com/dotnet/docs-maui/blob/main/docs/user-interface/layouts/absolutelayout.md#position-and-size-children) section (and maybe other places) seems to give incorrect information.
It says:
The AbsoluteLayout.LayoutBounds attached property can be set using two formats, regardless of whether absolute or proportional values are used:
- x, y. With this format, the x and y values indicate the position of the upper-left corner of the child relative to its parent. The child is unconstrained and sizes itself.
- x, y, width, height. With this format, the x and y values indicate the position of the upper-left corner of the child relative to its parent, while the width and height values indicate the child's size.
To my understanding, the parts in bold are incorrect, at least in the case of proportional positioning. It doesn't specify the position of the top left (at the very least it should probably say "top" instead of "upper" anyway...) corner of the child. A non-trivial calculation is being done based on the dimensions of the child and the parent.
If something like ".5, .5" is specified then the top left corner of the child is not placed at the center of the parent (fortunately). For the somewhat trivial case of ".5, .5", the result is that child's center is placed at the center of the parent. More generally, the positioning is proportional to the available space the child has. So, it is proportional to the difference between the parent's dimension and its dimension, i.e. (parentDimension - childDimension) * proportionalValue.
So in terms of the top left corner (which I think is confusing no matter what in the proportional case), it is relative to the parent and the child.
I think the bullet points are correct for absolute positioning, but the first sentence in the section gives them as being valid regardless of whether absolute or proportional values are used, but I think that creates some confusion. What does that even mean? Is it talking about when any of the AbsoluteLayoutFlags.*Proportional values are specified? Or something else? If it is the former, then it is simply incorrect.