'Custom MAUI layout don't show any Control, but control have correct position and size,
I custom a layout name ConstraintLayout according to AbsoluteLayout in MAUI.
It like AbsoluteLayout have a LayoutManager class,i overrride Measure and ArrangeChildren method in this class.
It also have a ConstrainLayout class.
public class ConstraintLayout : Layout, IConstraintLayout
Source Code at ConstraintLayout.Maui
I print control information, found control in layout have correct position and size, such as position of Entry at center of window. but nothing show at window.
I need set something at builder or Handler? i don't find doc about it.
Solution 1:[1]
I see that AbsoluteLayout works via a LayoutManager.
Find AbsoluteLayout.cs. See its:
protected override ILayoutManager CreateLayoutManager()
Do similar, but find AbsoluteLayoutManager.cs, and make a similar ConstraintLayoutManager that uses your constraint logic. Then your method in ConstraintLayout will be:
protected override ILayoutManager CreateLayoutManager()
{
return new ConstraintLayoutManager(this);
}
NOTE: Don't do my (now deleted) comment's ConstraintLayout : AbsoluteLayout .... Go back to your original ConstraintLayout : Layout, IConstraintLayout.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
