lsc
lsc

Reputation: 681

Dynamically changing the value for height constraint of a Xamarin content view

I am using a ContentView inside Xamarin form. There I have height constraint define for that content view.

<gComments:GCommentEntryView x:Name="gCommentEntryView"
    RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1, Constant=100}"

Is there a way that I can change dynamically this value of height constraint via code behind?

Upvotes: 1

Views: 742

Answers (1)

Artem Tishchenko
Artem Tishchenko

Reputation: 340

You can use it

Device.BeginInvokeOnMainThread(() => 
{ 
    RelativeLayout.SetHeightConstraint(gCommentEntryView, Constraint.RelativeToParent(layout => 100));                              
});

Upvotes: 1

Related Questions