Skip to content

Commit 3638377

Browse files
Copilotkazo0
andcommitted
docs: Improve IsReverseZIndex and Padding explanations per review feedback
Co-authored-by: kazo0 <[email protected]>
1 parent b24b1b7 commit 3638377

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

doc/controls/AutoLayout-vs-CSS-Flexbox.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,25 @@ This document provides a comprehensive comparison between the Uno Toolkit's `Aut
3838
|-------------|------------|-------|
3939
| `flex-direction: row` | `Orientation="Horizontal"` | Items flow left to right |
4040
| `flex-direction: column` | `Orientation="Vertical"` | Items flow top to bottom |
41-
| `flex-direction: row-reverse` | `Orientation="Horizontal"` + `IsReverseZIndex="True"` | Partial support - reverses z-order, not visual order |
42-
| `flex-direction: column-reverse` | `Orientation="Vertical"` + `IsReverseZIndex="True"` | Partial support - reverses z-order, not visual order |
41+
| `flex-direction: row-reverse` | Not directly supported | See note below |
42+
| `flex-direction: column-reverse` | Not directly supported | See note below |
4343

4444
> [!NOTE]
45-
> AutoLayout's `IsReverseZIndex` reverses the Z-order of children (which element appears on top when overlapping), but does not reverse the visual layout order like CSS `row-reverse` or `column-reverse`.
45+
> **Understanding `IsReverseZIndex`**: AutoLayout's `IsReverseZIndex` property only affects the stacking order (z-index) of children—determining which element appears on top when elements overlap. It does **not** reverse the visual layout order of items.
46+
>
47+
> CSS `row-reverse` and `column-reverse` visually reverse item order (last item appears first). To achieve this in AutoLayout, you would need to either:
48+
> - Reverse the order of children in XAML/code
49+
> - Use data binding with a reversed collection
50+
>
51+
> **Example of what `IsReverseZIndex` does:**
52+
> ```xml
53+
> <!-- Items are still laid out left-to-right, but Item3 has highest z-index (appears on top if overlapping) -->
54+
> <utu:AutoLayout Orientation="Horizontal" IsReverseZIndex="True">
55+
> <Border x:Name="Item1" /> <!-- Z-Index: 2 (lowest, behind others) -->
56+
> <Border x:Name="Item2" /> <!-- Z-Index: 1 -->
57+
> <Border x:Name="Item3" /> <!-- Z-Index: 0 (highest, in front) -->
58+
> </utu:AutoLayout>
59+
> ```
4660
4761
### Gap / Spacing
4862
@@ -332,7 +346,27 @@ This mirrors Figma's "Absolute Position" feature, where an item can be positione
332346
```
333347

334348
> [!WARNING]
335-
> AutoLayout's `Padding` behavior matches Figma's implementation: the padding values that apply depend on the alignment settings. For example, items aligned to `Start` will respect start padding, while items aligned to `End` will respect end padding.
349+
> AutoLayout's `Padding` behavior matches Figma's implementation: the padding values that apply depend on the alignment settings.
350+
351+
**Example - Padding behavior based on alignment:**
352+
```xml
353+
<!-- When PrimaryAxisAlignment="Start" (default), only start padding applies -->
354+
<utu:AutoLayout Padding="20,10,20,10" PrimaryAxisAlignment="Start">
355+
<Border /> <!-- Gets left padding (20px) in horizontal, top padding (10px) in vertical -->
356+
</utu:AutoLayout>
357+
358+
<!-- When using Stretch or SpaceBetween, both start and end padding apply -->
359+
<utu:AutoLayout Padding="20,10,20,10" Justify="SpaceBetween">
360+
<Border /> <!-- Gets both left (20px) and right (20px) padding in horizontal -->
361+
</utu:AutoLayout>
362+
363+
<!-- When PrimaryAxisAlignment="End", only end padding applies -->
364+
<utu:AutoLayout Padding="20,10,20,10" PrimaryAxisAlignment="End">
365+
<Border /> <!-- Gets right padding (20px) in horizontal, bottom padding (10px) in vertical -->
366+
</utu:AutoLayout>
367+
```
368+
369+
This differs from CSS Flexbox where padding always applies to all sides regardless of content alignment.
336370

337371
## Common Scenarios
338372

0 commit comments

Comments
 (0)