Skip to content
xtuzy edited this page Mar 8, 2023 · 7 revisions

Welcome to the SharpConstraintLayout wiki! There have some document about api.

What is FluentConstraintSet/ConstraintSet

ConstraintSet record all descriptions of constraints, these constraints define the relationship between controls. ConstraintLayout according to these constraints to calculate size and position of controls.

FluentConstraintSet supply a fluent api for ConstraintSet.

You can only create constraints in code, if you want hotreload, you can create constraints in event like SizeChanged, c# hotreload will load it when size changed of view.

Process of using SharpConstraintLayout

  • use new ConstraintLayout() create ConstraintLayout
  • use AddElement() add control to ConstraintLayout
  • use new FluentConstraintSet() create FluentConstraintSet
    • use Clone() from ConstraintLayout get old constraints and all controls id
    • use Select() select a control, then specify constraints for it, such as LeftToLeft(), if no params, mean control's left align with ConstraintLayout's left
    • use AppplyTo() apply FluentConstraintSet to ConstraintLayout
Clone this wiki locally