-
DescriptionStackLayout is a control that has 2 other controls HorizontalStackLayout and VerticalStackLayout that can be created using the Stacklayout control with the property Orientation. I personally don't mind the redundancy in syntax but after reading the documentation I read that HorizontalStackLayout and VerticalStackLayout are different in performance. from StackLayout ... WHY? Public API ChangesStackLayout could be used for both HorizontalStackLayout and VerticalStackLayout through the compiler with the Orientation property. I am not opposed to the redundancy / shorthand with HorizontalStackLayout and VerticalStackLayout Intended Use-Case<StackLayout Orientation="Horizontal".... <StackLayout Orientation="Vertical".... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Because StackLayout has to handle the In MAUI.Controls, the StackLayout is built from the Horizontal- and VerticalStackLayout classes - it looks at the value of the So if you know that your layout orientation will never change, it's very slightly more performant to use a VerticalStackLayout or HorizontalStackLayout. That's the only performance difference. It's small, but it's worth noting because it can make a difference at scale (for instance, inside of DataTemplates). We also provide the StackLayout with the |
Beta Was this translation helpful? Give feedback.
Because StackLayout has to handle the
Orientation
property, and the other two do not.In MAUI.Controls, the StackLayout is built from the Horizontal- and VerticalStackLayout classes - it looks at the value of the
Orientation
property and switches between the other two classes internally.Orientation
is a bindable property, which means the StackLayout has to be prepared for it change at any time, and update the internal layout accordingly. And this has a slight performance impact.So if you know that your layout orientation will never change, it's very slightly more performant to use a V…