Skip to content
This repository has been archived by the owner on Apr 2, 2022. It is now read-only.

RelativeLayout missing support for RelativeToView #93

Open
edgarfgp opened this issue Mar 1, 2022 · 0 comments
Open

RelativeLayout missing support for RelativeToView #93

edgarfgp opened this issue Mar 1, 2022 · 0 comments

Comments

@edgarfgp
Copy link
Contributor

edgarfgp commented Mar 1, 2022

RelativeToView is missing from v1 and V2 . Would be good to see if there is anyway we can support this as we move forward to stable 2.0

public static Constraint RelativeToView(View view, Func<RelativeLayout, View, double> measure)
{
	var result = new Constraint { _measureFunc = layout => measure(layout, view), RelativeTo = new[] { view } };

	return result;
}
  • BoundsConstraint
public static BoundsConstraint FromExpression(Expression<Func<Rectangle>> expression, IEnumerable<View> parents = null)
{
	return FromExpression(expression, false, parents);
}

internal static BoundsConstraint FromExpression(Expression<Func<Rectangle>> expression, bool fromExpression, IEnumerable<View> parents = null)
{
	Func<Rectangle> compiled = expression.Compile();
	var result = new BoundsConstraint
	{
		_measureFunc = compiled,
		RelativeTo = parents ?? ExpressionSearch.Default.FindObjects<View>(expression).ToArray(), // make sure we have our own copy
		CreatedFromExpression = fromExpression
	};

	return result;
}
@edgarfgp edgarfgp changed the title RelativeLayout missing support for RelativeToView support RelativeLayout missing support for RelativeToView Mar 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant